<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>var t; <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>함수 b() <br>{ <br>clearTimeout(t); <br>document.getElementById('input2').focus(); <br>} <br>함수 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>光标停留一段时间,跳到别一个方本框中去…