function toForm(theForm, theField) {
document.theForm.theField.focus();
}
and then called it by:
onLoad="toForm('form1','Firstname')
The problem is that what you're passing into the function is a string, not
a form object. The way JS works, it's going to expect a form object.
Instead, try this:
function toForm(theField) {
theField.focus();
}
onLoad="toForm(document.form1.Firstname)"
To answer your second question, you'll have to get into the form's
collection of elements. There's way too much to go over right here all at
once, but the nutshell version is that in the same way you can say
document.form1.Firstname, you can also say document.form1.elements[0] if
the Firstname field is the first field in the form.
As bad as their browser was / is, Netscape still has the best online
documentation on JavaScript. The O'Reilly book is probably better, but I
haven't seen it myself to say for sure.
JavaScript Reference:
http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm
JavaScript Reference in PDF:
http://developer.netscape.com/docs/manuals/js/client/jsguide/ClientGuideJS13.pdf
|------------------------------------+------------------------------------|
|Eric A. Laney |"Time wounds all heels." |
|Systems Engineer | |
|LAN Optimization Team | |
|Voice: 813.978.4404 | - Jane Ace|
|Pager: 888.985.8519 | |
|------------------------------------+------------------------------------|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists