<style>
div.IPDiv{background:#ffffff;120;font-size:9pt;text-align:center;border:2 ridge threedshadow;border-right:inset threedhighlight;border-bottom:inset threedhighlight;
}
input.IPInput{24;font-size:9pt;text-align:center;border-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