Copy codeThe Code is as follows:
<! 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>
<Title> js cursor switching </title>
<Script type = "text/javascript">
Var t;
Function ()
{
Document. getElementById ('input1'). focus ();
T = setTimeout ("B ()", 3000 );
// ClearTimeout (t );
// Document. getElementById ('input2'). focus ();
// Document. getElementById ('input1'). focus ();
}
Function B ()
{
ClearTimeout (t );
Document. getElementById ('input2'). focus ();
}
Function c ()
{
SetTimeout ("document. getElementById ('input3'). focus ()", 500 );
}
</Script>
</Head>
<Body>
<Input id = "testButton" type = "button" onclick = "a ()" value = 'btn1 '>
<Input type = "text" id = "input1">
<Input type = "text" id = "input2">
<Input id = "testButton1" type = "button" onclick = "c ()" value = 'btn2'>
<Input type = "text" id = "input3">
</Body>
</Html>
The cursor stays for a while, jump to another square box ......