首页 > 代码库 > IP地址输入框
IP地址输入框
<style>
div.IPDiv{background:#ffffff;width:120;font-size:9pt;text-align:center;border:2 ridge threedshadow;border-right:inset threedhighlight;border-bottom:inset threedhighlight;
}
input.IPInput{width:24;font-size:9pt;text-align:center;border-width:0;
}
</style>
<script language="JScript" for="document" event="onkeydown">
if(event.keyCode==13)event.keyCode=9;
</script>
<script language="JScript">
var IPlikeInputStr=[];
for(var i=0;i<4;i++)IPlikeInputStr[i]="<input class="IPInput" name=IPInput type=text size=3 maxlength=3 onkeydown=‘if(event.srcElement.value.length==3||event.keyCode==39)event.keyCode=9‘>"+(i==3?"":".");
document.write("<div class="IPDiv">"+IPlikeInputStr.join("")+"</div>");
</script>
摘自 : http://www.jb51.net/article/590.htm
IP地址输入框