Hey people... me again ;-)
I'm having a problem with, as my title says, parseInt and some focus or select (not sure which one goes, since none work)
Here's part of my code - note that this is an assignment (ie, there would be easier ways to get to the result I need, but I have directions)
HTML
and here's the Javascript that goes with it. I have worked with only one day (just need to copy and paste when I got it right). By the way, the table above is in a form named EmpInfo
I get two major problems:
* first, on the parseInt() line
"Object expected" error
* second, none of those line execute
document.EmpInfo.hr=" ";
document.EmpInfo.hr.select();
and I get "object does not support this method or property" error
I've played with this in all the ways I could think of to make it work, but I can't seem to figure it out. I have the same problem with a previous assignment, but was able to bypass it.
Here, the error checking needs to be done in Javascript, and the processing of the data will be done in PHP
I'm having a problem with, as my title says, parseInt and some focus or select (not sure which one goes, since none work)
Here's part of my code - note that this is an assignment (ie, there would be easier ways to get to the result I need, but I have directions)
HTML
Code:
<!---- WEEKDAYS & HOURS INPUT ----> <table width="700" frame=box rules=none border=5 name="hours_input" align="left" cellspacing=5 cellpadding=10> <tr><td colspan=7><I><center>Input the number of hours the employee has worked this week:</center></I></td></tr> <tr><th align=left width="15%">Monday</th> <th align=left width="15%">Tuesday</th> <th align=left width="15%">Wednesday</th> <th align=left width="15%">Thrusday</th> <th align=left width="15%">Friday</th> <th align=left width="15%">Saturday</th> <th align=left width="15%">Sunday</th></tr> <tr><td><center> <input type="text" value="" name="day0" size=1 onChange="validateHours(this, 'Monday');"> </center></td> <td><center> <input type="text" value="" name="day1" size=1> </center></td> <td><center> <input type="text" value="" name="day2" size=1> </center></td> <td><center> <input type="text" value="" name="day3" size=1> </center></td> <td><center> <input type="text" value="" name="day4" size=1> </center></td> <td><center> <input type="text" value="" name="day5" size=1> </center></td> <td><center> <input type="text" value="" name="day6" size=1> </center></td> </tr> </table>
Code:
function validateHours(hour, day) { hr=hour.value; if (day =='Monday' || day =='Tueday' || day =='Wednesday' || day =='Thursday' || day =='Friday') { parseInt(hr); if (hr > 15 || isNan(hr)) { alert("You could not have worked " + hr + " hours on " + day); document.EmpInfo.hr=" "; document.EmpInfo.hr.select(); } } }
* first, on the parseInt() line
"Object expected" error
* second, none of those line execute
document.EmpInfo.hr=" ";
document.EmpInfo.hr.select();
and I get "object does not support this method or property" error
I've played with this in all the ways I could think of to make it work, but I can't seem to figure it out. I have the same problem with a previous assignment, but was able to bypass it.
Here, the error checking needs to be done in Javascript, and the processing of the data will be done in PHP
Comment