[Javascript] wrox code question
Peter Brunone
peter at brunone.com
Mon Jul 9 15:08:01 CDT 2001
I've erased the code, but... weren't they doing that in a function?
----- Original Message -----
From: Josiah Gordon
To: javascript at LaTech.edu
Sent: Monday, July 09, 2001 2:56 PM
Subject: RE: [Javascript] wrox code question
Carl,
> why does the indicated number NOT change when the page is refreshed.
They are making a rather careless mistake. They are setting the value of an
input before it exists. This *sometimes* works, but really shouldn't.
They are using an in-line script so that they can render the question HTML
randomly when the page loads, but are setting the value of txtQNumber before
they have written the HTML that creates that input.
Instead, the value of the input should be set when the page loads (although,
there are several ways that the same thing can be accomplished):
<BODY onLoad="javascript:document.QuestionForm.txtQNumber.value =
questionNumber + 1">
Try putting that line in your code. Without any other changes, the page will
work fine.
--Josiah Gordon
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.264 / Virus Database: 136 - Release Date: 7/2/2001
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010709/c6864180/attachment.htm>
More information about the Javascript
mailing list