Hi,

How can I add via javascript an Event Attribute like onkeyup="xyz(this.value)" in a text input ?

function x()
{
if (condition)
{
document.definesearch.textsearch. ???? ;
}
}


definesearch is the name of the form.
textsearch is the name of the text input.

I tried this : document.definesearch.textsearch.onkeyup="xyz(this.value)";

but it doesn't work..

plzz help :)
thnx :)

Does the element have an id (as opposed to a name)?
If so, the code is fairly simple.
If not, it is more complicated.

no it hasn't but can't I add one?


<input type="text" name="textsearch" id="ts" size="40" style="width:95%"/>

?!?! If you can do that, just add the onkeyup= instead.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.