Forum Moderators: open

Message Too Old, No Replies

window.onfocus drives me crazy

         

timmy01

2:32 pm on Dec 21, 2009 (gmt 0)

10+ Year Member



got here a simple sample page...
(the orginal contains more information)
But since i am not sure where the bug comes from i am just posting this sample.

After page loading it (Firebug) returns a javascript error saying:

"document.buttoncalendar is undefined
anonymous()"

I tried just about anything, like the names, numbers, upload the source
static and main server and on my local test server. And i keep getting
different results.

The page is dynamicly build so depending on the mysql output does it get one or more document.button#..

I hope someone can give me hint.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<script type="text/javascript">
window.onfocus = function () {
document.button3.number3.value = 'hello'; document.button3.number3.disabled = false;
document.button5.number5.value = 'hello'; document.button5.number5.disabled = false;
<!--//document.button7.number7.value = 'hello'; document.button7.number7.disabled = false; //-->

document.buttoncalendar.numbercal.value = 'calendar check'; document.buttoncalendar.numbercal.disabled = false;
}
</script>
</head>
<body>

<form action="hotelres.htm" method="post" name="button3">
<input class="core-button" type="submit" name="number3" value="boek nu" onclick="document.button3.number3.value='One moment...';document.button3.number3.disabled=true;document.button3.submit();" />
</form>

<form action="hotelres.htm" method="post" name="button5">
<input class="core-button" type="submit" name="number5" value="boek nu" onclick="document.button5.number5.value='One moment...';document.button5.number5.disabled=true;document.button5.submit();" />
</form>

<form method="post" name="buttoncalendar" action="">
<!-- here the calendar content //-->
<input class="core-button" type="submit" name="numbercal" value="beschikbaar?" onclick="document.buttoncalendar.numbercal.value='One moment...'; document.buttoncalendar.numbercal.disabled=true; document.buttoncalendar.submit();" />
</form>

</body>
</html

Fotiman

3:17 pm on Dec 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld!
Instead of:
document.button3.number3.value ...
Try this:
document.forms["button3"].number3.value ...