My latest Technically Speaking column (called "Information at Your Fingertips") for IEEE Spectrum magazine is now online:
Hi,
I'm trying to write a javascript funtion that would determine the number of days left in a specific month entered by the user. Basically the page will have two TBox where the user will enter the month and the date, than a button to call the final function that determine the days left in that month and will display it in another text box on the page. I just got started but I'm already stuck! I would appreciate any help.
here is my program so far (probably with some errors):
<html>
<head>
<title>Days Left in the Month</title>
<script type="text/javascript">
//Paolo Zoglianti
//This function will detrmine the total days in the month entered by the user
function daysInTheMonth(month)
{
var monthsDays;
monthsDays=parseInt(window.document.dayForm.monthTBox.value);
if (month==2){
monthsDays=28;
}
else {
if (month==4)||(usersMonth==6)||(month==8)|| (month==11){
monthsDays=30;
monthsDays=31;
return monthsDays;
function determineDaysLeft();
var month;
var daysIn;
var daysLeft;
daysIn=parseInt(window.document.dayForm.dateTBox.value);
month=daysInTheMonth(month);
daysLeft = month - daysIn;
//display in text box
window.document.dayForm.daysLeftTBox=daysLeft;
</script>
</head>
<body>
<form name="dayForm">
Enter a month (1-12):
<input type="text" size="25" name="monthTBox"></input>
<br/>
Enter the date (1-31):
<input type="text" size="25" name="dateTBox"></input>
<input type="button" value="How many days left?" onClick="determineDaysLeft();"></input>
<hr/>
The number of days left in the month is:
<input type="text" size="25" name="daysLeftTBox"></input>
</form>
</body>
</html>
Thanks!
Hi Paul, My name is Matthew and I bought your book, Creating a Web Page...
I have a few questions thro... Do I need a business license ? Where do I find a Privacy Policy ? My site is called www.yurpost.com I haven't finished it yet, so I didn't up-load it, I still have a lot of work to do to it.... It's a site that everyone can post there artistic abilities and has lots of categories... I'm concerned about the copyright and legal stuff that I need to know.. Also, Can I use the graphics in the books CD for my web site ?? Hope you can help..... Thank you. Matt Sproul
wtre8@yahoo.com