PDA

View Full Version : Form Focus


TRACEYR
06-26-2002, 09:36 PM
I have a form that i was trying to get form focus on when the page loads, i used function sf, this worked for I.E and netscape but not for Galeon..linux

So i added the other scripts below and called
onclick="dynOutline()"> in the body..........
But i cannot understand that calling dynOutline() does anything ...as there is nothing in this part of the script.

<script language="JavaScript" fptype="dynamicoutline">
<!--
function dynOutline() {}
//-->
</script>


So please help me understand the code..........
It works.........but i like to know what it is doing.





<script type="text/javascript"><!--
function sf(){
document.f.q.focus();
window.focus() ;
document.f.q.focus();
}
// -->
</script>


<script language="JavaScript" fptype="dynamicoutline">
<!--
function dynOutline() {}
//-->
</script>
<script language="JavaScript1.2" fptype="dynamicoutline" for="document" event="onreadystatechange()">
<!--
//-->
</script>

</head>


<body onLoad=sf() bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onclick="dynOutline()">

TrueLies
06-28-2002, 05:46 AM
well if your form has a name
<form name="form1">

pick a field which has a name
<input type="text" name="field1">

and then
<body onLoad="document.form1.field1.focus()">

giving the focus to a form element gives the focus to the form as well, or if you prefer:


<form>
<a name="anchor1">&nbsp;</a>

then:
<body onLoad="location.href='#anchor1';">

note the # and the single apex

ciao