Forum Moderators: open
Anyone know?
the function i want to attach is onmouseover:
function ss(theHREF){var url = /url=(.+)/.exec(theHREF)[1];alert(url);}
links[i].onMouseOver = "ss(" + links[i].href + ");";
Notice that onMouseOver is case-sensitive - everything in JavaScript is.
p.s. We have a dedicated JavaScript forum here ;)
[webmasterworld.com...]
-----------
Thanks for mentioning the Javascript Forum.
I decided to move the thread to a new home.
[edited by: tedster at 5:33 am (utc) on June 15, 2004]
[blue]onmouseover[/blue]. The best thing to do is direct it to a link method:
for (var i=0,len=links.length; i < len; i++){
links[i].onmouseover = ss
}// function looks like this...
function ss()
{
var url = /url=(.+)/.exec([blue]this[/blue].href)[1];
alert(url);
}
..although I don't understand the regular expression part myself.
Martin, I strongly disagree (is the best way of putting it). It seems you are adding the event handler as an attribute, and concatenating an appropriate value to put in it. This isn't really worthwhile. More importantly, it doesn't work. Have you tried this?
When it's part of some JavaScript code, use onMouseOver.
When it's an XHTML attribute, use onmouseover.
- Use onmouseover all the time. It's easier.
Best bet? "When in doubt, try it out."