日期:2014-05-16  浏览次数:20338 次

使用这个角本后为什么不能删除数字了.要怎么修改?
<script   language=javascript>
function   onlyNum()
{
    if(!((event.keyCode> =48&&event.keyCode <=57)||(event.keyCode> =96&&event.keyCode <=105)))
        event.returnValue=false;
}
</script>

<input   onkeydown= "onlyNum(); ">

------解决方案--------------------
<script language=javascript>
function onlyNum()
{
if(!((event.keyCode> =48&&event.keyCode <=57)|| (event.keyCode==8)||(event.keyCode> =96&&event.keyCode <=105)))
event.returnValue=false;
}
</script>

<input onkeydown= "onlyNum(); ">
------解决方案--------------------
<script language=javascript>
function onlyNum()
{
if(!((event.keyCode> =48&&event.keyCode <=57)|| (event.keyCode==8)|| (event.keyCode==190)||(event.keyCode> =96&&event.keyCode <=105)))
event.returnValue=false;
}
</script>

<input onkeydown= "onlyNum(); ">
------解决方案--------------------
上面的(好象用中文的了,改下:
<script language=javascript>
function onlyNum()
{
if(!((event.keyCode> =48&&event.keyCode <=57)|| (event.keyCode==8)|| (event.keyCode==190)||(event.keyCode> =96&&event.keyCode <=105)))
event.returnValue=false;
}
</script>

<input onkeydown= "onlyNum(); ">
------解决方案--------------------
<script language=javascript>
function onlyNum()
{
if(!((event.keyCode> =48&&event.keyCode <=57)|| (event.keyCode==8)||(event.keyCode==190)||(event.keyCode> =96&&event.keyCode <=105)))
event.returnValue=false;
}
</script>
<input onkeydown= "onlyNum(); ">