IP输入问题

skee 2004-09-04 10:29:45
分四个文本框输入IP:如192.168.0.1
如果要在用户按下“.”键以后自动跳到下一个文本框,要如何操作,请高手指点!谢谢
...全文
110 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
skee 2004-09-18
  • 打赏
  • 举报
回复
还有个问题,例如文本框里有三个字符,如何把光标移动到第二个字符处?
woyingjie 2004-09-04
  • 打赏
  • 举报
回复
<input type=text name=text0 onpropertychange=woyingjie(this.value,1)>
<input type=text name=text1 onpropertychange=woyingjie(this.value,2)>
<input type=text name=text2 onpropertychange=woyingjie(this.value,3)>
<input type=text name=text3>
<script>
function woyingjie(hoho,i){
if(hoho.indexOf(".")>-1){
document.all("text"+(i-1)).value=hoho.substring(0,hoho.length-1)
document.all("text"+i).focus();
}
}
</script>
smallyear 2004-09-04
  • 打赏
  • 举报
回复
用KEYDOWN事件控制﹐如果按下的是"."﹐就把KEYCODE改為9﹐TAB到下一個框
skee 2004-09-04
  • 打赏
  • 举报
回复
非常感谢楼上的高手,本人还有个问题,那能不能在输入的时候不显示“.”,而直接跳到下一个文本框呢?
woyingjie 2004-09-04
  • 打赏
  • 举报
回复
<input type=text name=text0 onkeypress=woyingjie(this.value,1)>
<input type=text name=text1 onkeypress=woyingjie(this.value,2)>
<input type=text name=text2 onkeypress=woyingjie(this.value,3)>
<input type=text name=text3>
<script>
function woyingjie(hoho,i){
if(hoho.indexOf(".")>-1){
document.all("text"+i).focus();
}
}
</script>

87,987

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧