<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> the text box automatically obtains the focus. </title>
</Head>
<Body>
<Form ID = "form1" name = "form1">
<Input type = "text" id = "txt1" name = "txt1"/>
</Form>
<Form ID = "form2" name = "form2">
<Input type = "text" id = "txt2" name = "txt2"/>
</Form>
</Body>
<Script language = "JavaScript" type = "text/JavaScript">
// Note: the Dom can be operated only after it is loaded. That is to say, this Code cannot be stored in VaR texts = Document. getelementsbytagname ("input ");
For (VAR I = 0; I <texts. length; I ++)
{
If (texts (I). type = "text ")
{
Texts (I). onmouseover = function () {This. Focus ();}
}
}
</SCRIPT>
</Html>