...

View Full Version : onChange



sherlockturtle
10-07-2011, 02:04 AM
I have a onChange value

var people = [
["Timothy Conner", "1999-Present", "Age: 12", "Male", ""],
["Andrew Conner", "1992-Present", "Age: 19", "Male", ""]
];

var how = "Brothers";

function find()
{
if(document.getElementById("name").value == people [0] [0])
{
document.getElementById("desc").value = people [0] [1] + " " + people [0] [2] + " " + people [0] [3];
}
if(document.getElementById("name").value == people [1] [0])
{
document.getElementById("desc").value = people [1] [1] + " " + people [1] [2] + " " + people [1] [3];
}
document.getElementById("relateb").value = document.getElementById("name").value;
}


Name: <input type="text" id="name" value="" onChange="find()"/>
So for it to proses a name you must click out of a box is ther a way to make it instead of when you click out of it, it would immidiatly change?

DaveyErwin
10-07-2011, 02:31 AM
To trigger events , either onblur
or onchange you must give focus
to something else or as you say
"click out of it" Old Pedant has
proposed another solution , you
could periodically check the value
with a setTimeout and respond if
the value has changed.
The usual way is to use keyup and
keydown events (but these
don't respond to pasted data)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum