umen
06-25-2002, 09:49 AM
Hello list
well this is i guess simple question ,i have <INPUT type="text" .....>
now i like to prevent typing in some condition ,i have onkeydown=foo(window.event.keyCode)
that checks the input that the user typed
and this is the function
------------------------------------------------------------------
function foo(x)
{
if(x=='32')
return false;
}
----------------------------------------------------------------------
simple right ? but this is not preventing to type the char,
do i need to remove the last char in the string every time ?
something like :
---------------------------------------------------------------------
var z=document.getElementById(y).value
z=z.substr(0,z.length-1)
document.getElementById(y).value=z;
-----------------------------------------------------------------------
why the return false; dont work in this case?
thanks
well this is i guess simple question ,i have <INPUT type="text" .....>
now i like to prevent typing in some condition ,i have onkeydown=foo(window.event.keyCode)
that checks the input that the user typed
and this is the function
------------------------------------------------------------------
function foo(x)
{
if(x=='32')
return false;
}
----------------------------------------------------------------------
simple right ? but this is not preventing to type the char,
do i need to remove the last char in the string every time ?
something like :
---------------------------------------------------------------------
var z=document.getElementById(y).value
z=z.substr(0,z.length-1)
document.getElementById(y).value=z;
-----------------------------------------------------------------------
why the return false; dont work in this case?
thanks