sayedsohail Posted May 27, 2007 Share Posted May 27, 2007 onkeyup is not working in mozilla, please suggest a way to sprint my function. <Input id="address" type="text" onkeyup="javascript:sndReqArg(this.value)"> Quote Link to comment Share on other sites More sharing options...
gabeg Posted May 27, 2007 Share Posted May 27, 2007 Does this infact work in other browsers? what happens when you call the function sndReqArg by itself without being called from onkeyup? did you make a typo and its suppose to be sendReqArg? Quote Link to comment Share on other sites More sharing options...
sayedsohail Posted May 28, 2007 Author Share Posted May 28, 2007 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. ??? Quote Link to comment Share on other sites More sharing options...
obsidian Posted May 28, 2007 Share Posted May 28, 2007 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. Quote Link to comment Share on other sites More sharing options...
sayedsohail Posted May 28, 2007 Author Share Posted May 28, 2007 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);" Quote Link to comment Share on other sites More sharing options...
gabeg Posted May 28, 2007 Share Posted May 28, 2007 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 Quote Link to comment Share on other sites More sharing options...
obsidian Posted May 28, 2007 Share Posted May 28, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.