<div class="codetitle"> <span><a style="CURSOR: pointer" data="16283" class="copybut" id="copybut16283" onclick="doCopy('code16283')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code16283"> <br>br><br>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br> <br> <br><title>js切换光标</title> <br><script type="text/javascript"> <BR>var t; <BR>function a() <BR>{ <BR>document.getElementById('input1').focus(); <BR>t=setTimeout("b()",3000); <BR>//clearTimeout(t); <BR>//document.getElementById('input2').focus(); <BR>//document.getElementById('input1').focus(); <BR>} <BR>function b() <BR>{ <BR>clearTimeout(t); <BR>document.getElementById('input2').focus(); <BR>} <BR>function c() <BR>{ <BR>setTimeout("document.getElementById('input3').focus()",500); <BR>} <BR></script> <br> <br> <br><input id="testButton" type="button" onclick="a()" value="btn1"> <br><input type="text" id="input1"> <br><input type="text" id="input2"> <br><br><input id="testButton1" type="button" onclick="c()" value="btn2"> <br><input type="text" id="input3"> <br> <br> <br> </div> <br>光标停留一段时间,跳到别一个方本框中去……