Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

handlers

Status
Not open for further replies.

imadmarie

Programmer
Nov 14, 2001
14
JO
guys, this is what im trying to do,
i want to change the onmouseout handler at run time using javascript
i.e. : object.onmouseout=myfunction
the problem is that i can't pass parameters to this handler when i set it at runtime
i.e. : object.onmouseout=myfunction(2) /* this would give an error */

anyhelp ?
 
I would suggest putting the onmouseout through another function which calls your original function with whatever parameter is required.

example:

function whichParameter() {
if (mycondition == true){
myfunction();
}
else {
myfunction(2);
}
}

<div onmouseout=&quot;whichParameter()&quot;>

Hope this helps. If not, let me know why you need to change the parameter.

 
This might do it.

object.onmouseout= function { myfunction(2); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top