Jump to content

onkeyup not working in mozilla any work around please.


sayedsohail

Recommended Posts

Thanks its working now, but if i tried to use settimeout and settimeinterval i got another problem here is the code:

 

I am trying to delay calling a function sndReqArg(this.value), in my html page.

 

The function works if call directly without any timeinterval/timedelay

 

 

Code:

<Input id="address" type="text" onKeyUp="sndReqArg(this.value);">

Unfortunately when i tried method to delay it says undefined variable.

 

here is what i tried

 

 

Code:

a)

onKeyUp=setTimeInterval("sndReqArg(this.value)",5000)>

 

b)

 

onKeyUp=setTimeout("sndReqArg(this.value)",5000)>

 

c)

 

onKeyUp=setTimeout(\"sndReqArg(this.value)\",5000)>

d)

 

Tried to call the function using a a sub function, all

produces the same error undefined variable.

 

 

Code:

function keyUp(avllist) {

var ais=document.form1.address.value;

window.setTimeout(sndReqArg(ais), 4000);

}

 

<INPUT TYPE='test' value='' onKeyUp=keyUp("this.value)>

Any help is greatly appreciated.

 

???

 

 

I'm not a big fan of the onkeyup event. Read up on all your different triggers, and you may be better off using one of the other keystroke traps. The most useful event I've found for trapping keystrokes is onkeypress instead.

This does work,

 

but it call the functions as many times i pressed a key in the text box,

 

onKeyUp="javascript:setTimeout('sndReqArg(document.form1.address.value)',500);"

okeyup will call the function everytime you press a key down and let go. sounds to me like you're looking for a different event handler than onkeyup

okeyup will call the function everytime you press a key down and let go. sounds to me like you're looking for a different event handler than onkeyup

 

Right. Either you need another event handler, or you need to set up some trapping that will throttle your requests and if you've already got one submitted, don't submit another until the first timeout is executed.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.