<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><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 移行//EN" <br><br>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml"> <br> <br><title>js切换光标</title> <br><script type="text/javascript"> <br>変数; <br>関数 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></head> <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></body> <br></html> <br> </div> <br>光标停留一段時,跳到别一方本框中去……