js切換光標(biāo)示例代碼
更新時(shí)間:2013年10月10日 16:34:32 作者:
切換光標(biāo)的方法有很多,在本文為大家詳細(xì)介紹下在js中時(shí)如何實(shí)現(xiàn)的,感興趣的朋友不要錯(cuò)過
復(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)停留一段時(shí)間,跳到別一個(gè)方本框中去……
您可能感興趣的文章:
- JavaScript自定義文本框光標(biāo)
- Javascript實(shí)現(xiàn)獲取及設(shè)置光標(biāo)位置的方法
- js光標(biāo)定位文本框回車表單提交問題的解決方法
- JS在可編輯的div中的光標(biāo)位置插入內(nèi)容的方法
- js實(shí)現(xiàn)獲取焦點(diǎn)后光標(biāo)在字符串后
- js獲取光標(biāo)位置和設(shè)置文本框光標(biāo)位置示例代碼
- 在頁面中js獲取光標(biāo)/鼠標(biāo)的坐標(biāo)及光標(biāo)的像素坐標(biāo)
- js/html光標(biāo)定位的實(shí)現(xiàn)代碼
- javascript textarea光標(biāo)定位方法(兼容IE和FF)
- JavaScript中在光標(biāo)處插入添加文本標(biāo)簽節(jié)點(diǎn)的詳細(xì)方法
相關(guān)文章
JS冷知識(shí)之不起眼但有用的String.raw方法
String.raw是JavaScript中模板字符串的一個(gè)標(biāo)簽函數(shù),它的作用是將模板字符串不轉(zhuǎn)義的原始字符串內(nèi)容返回,接下來通過本文給大家介紹JS冷知識(shí)之不起眼但有用的String.raw方法,需要的朋友可以參考下2022-06-06JavaScript暫停和繼續(xù)定時(shí)器的實(shí)現(xiàn)方法
這篇文章主要介紹了JavaScript暫停和繼續(xù)定時(shí)器的方法的相關(guān)資料,非常不錯(cuò),需要的朋友可以參考下2016-07-07基于Bootstrap的Java開發(fā)問題匯總(Spring MVC)
這篇文章主要為大家匯總了基于Bootstrap的Java開發(fā)問題,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-01-01