hi, i need to call two functions for a textbox on onkeyup event
function data_change(field)
{
var check = true;
var value = field.value; //get characters
for(var i=0;i < field.value.length; ++i)
{
var new_key = value.charAt(i); //cycle through characters
if(((new_key < "0") || (new_key > "9")) &&
!(new_key == ""))
{
check = false;
break;
}
}
if(!check)
{
field.style.backgroundColor = "red";
}
else
{
field.style.backgroundColor = "white";
}
}
function f2m(form)
{
var f = parseFloat(form.tlength.value);
var m = "";
if (!isNaN(f)) m = Math.round(f * 0.3048* 100)/100;
form.lm.value = m;
}
data_change(field) is also used by other textboxes, function f2m(form) is used only by one textbox.
i already tried combine them like onkeyup="return(data_change(this)&&f2m(this.form));"
any help please?
function data_change(field)
{
var check = true;
var value = field.value; //get characters
for(var i=0;i < field.value.length; ++i)
{
var new_key = value.charAt(i); //cycle through characters
if(((new_key < "0") || (new_key > "9")) &&
!(new_key == ""))
{
check = false;
break;
}
}
if(!check)
{
field.style.backgroundColor = "red";
}
else
{
field.style.backgroundColor = "white";
}
}
function f2m(form)
{
var f = parseFloat(form.tlength.value);
var m = "";
if (!isNaN(f)) m = Math.round(f * 0.3048* 100)/100;
form.lm.value = m;
}
data_change(field) is also used by other textboxes, function f2m(form) is used only by one textbox.
i already tried combine them like onkeyup="return(data_change(this)&&f2m(this.form));"
any help please?