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.

 

???

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.