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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning a mouseover event in script

Status
Not open for further replies.

sproket

Programmer
Mar 8, 2008
2
US
Hi everyone!

I have an issue where I need to assign a mouseover event in the script. So this is what I'm doing:

From the server the html looks like this:

<img id="image12345" src="/images/padlock.gif" alt="" onmouseover="showSpeedtip(this, '54321', lockedBySpeedtip)" onmouseout="hideSpeedtip()">


In the script I may need to periodically update the mouseover event (it's possible there could be a different 'lockedBy' number.

So I'm trying it like this:

var image = document.getElementById("image" + rowId);
image.src = "/images/padlock.gif"
image.style.display = "";
image.onmouseover = "showSpeedtip(this, '" + aLockedBy[rowId]+ "', lockedBySpeedtip)";
image.onmouseout = "hideSpeedtip()";

Problem is the new mouseover is not firing. I think it's because I need to assign it as a function pointer and not a string. How can I do that when I need to pass parameters?

Any Ideas?

TIA :)
 
Try this:

Code:
image.onmouseover = function() { showSpeedtip(this, aLockedBy[rowId], lockedBySpeedtip); }
image.onmouseout = hideSpeedtip;

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top