dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: javascript for sequential day numbers

Hybrid View

  1. #1
    Join Date
    Mar 2014
    Posts
    2

    javascript for sequential day numbers

    Can somebody help me with javascript to insert into an html page which will display Day 1, Day 2 etc sequentially up to Day 6, but would exclude weekend days?
    Or else, a script that would just do the day numbers and that I could manually adjust over the weekend.. would that work?
    Any help appreciated!

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,511
    If you can supply some code, you may get some help.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  3. #3
    Join Date
    Feb 2014
    Location
    Canada
    Posts
    155
    Quote Originally Posted by katy-rome View Post
    Can somebody help me with javascript to insert into an html page which will display Day 1, Day 2 etc sequentially up to Day 6, but would exclude weekend days?
    JavaScript offers a Date class and functions to retrieve the day, month and year. If the JavaScript is what you want, then try this. If not, you're going to have to explain how you want to keep track of the day.

    HTML Code:
    <!DOCTYPE html>
    <html>
    	<head>
    		<script type = "text/javascript">
    			window.onload = function() {
    				var theDate = new Date();
    				document.getElementById("dayNum").innerHTML = theDate.getDate();
    				document.getElementById("month").innerHTML = theDate.getMonth();
    				document.getElementById("full").innerHTML = theDate.toDateString();
    			}
    		</script>
    		<style>
    			span
    			{
    				font-weight: bold;
    			}
    		</style>
    	</head>
    	<body>
    		<p>Current day number is <span id = "dayNum"></span></p>
    		<p>Current day name is <span id = "month"></span></p>
    		<p>Full date is <span id = "full"></span></p>
    	</body>
    </html>

  4. #4
    Join Date
    Mar 2014
    Posts
    2
    I think you have both answered my question - which is that I'm barking up the wrong tree!! Javascript is not the answer, right?!

    I think my problem can be solved through using a plugin (probably a calendar function), having my day numbers in there in addition to any other info I want for the days, and displaying this on my page.

    Many thanks for taking the time to respond, I really appreciate it.

  5. #5
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,511
    You can get JavaScript calendar scripts, some are primitive others are more dynamic, so it takes some hunting around.

    I started writing a JavaScript calendar for myself and it is quite complex thing to do just on the rendering aspect.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles