js切換光標(biāo)示例代碼
更新時間:2013年10月10日 16:34:32 作者:
切換光標(biāo)的方法有很多,在本文為大家詳細(xì)介紹下在js中時如何實現(xiàn)的,感興趣的朋友不要錯過
復(fù)制代碼 代碼如下:
<!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切換光標(biāo)</title>
<script type="text/javascript">
var t;
function a()
{
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>
光標(biāo)停留一段時間,跳到別一個方本框中去……
您可能感興趣的文章:
- JavaScript自定義文本框光標(biāo)
- Javascript實現(xiàn)獲取及設(shè)置光標(biāo)位置的方法
- js光標(biāo)定位文本框回車表單提交問題的解決方法
- JS在可編輯的div中的光標(biāo)位置插入內(nèi)容的方法
- js實現(xiàn)獲取焦點后光標(biāo)在字符串后
- js獲取光標(biāo)位置和設(shè)置文本框光標(biāo)位置示例代碼
- 在頁面中js獲取光標(biāo)/鼠標(biāo)的坐標(biāo)及光標(biāo)的像素坐標(biāo)
- js/html光標(biāo)定位的實現(xiàn)代碼
- javascript textarea光標(biāo)定位方法(兼容IE和FF)
- JavaScript中在光標(biāo)處插入添加文本標(biāo)簽節(jié)點的詳細(xì)方法
相關(guān)文章
JavaScript暫停和繼續(xù)定時器的實現(xiàn)方法
這篇文章主要介紹了JavaScript暫停和繼續(xù)定時器的方法的相關(guān)資料,非常不錯,需要的朋友可以參考下2016-07-07基于Bootstrap的Java開發(fā)問題匯總(Spring MVC)
這篇文章主要為大家匯總了基于Bootstrap的Java開發(fā)問題,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-01-01