Mon, 2004-08-02 21:57
Newbie here. Hope this is the right forum to post this in.
I use the <a href=".." OnMouseOver="beep()"> method to
beep a certain sound when the mouse passes over the links. However, if I have a thousand links in one page, or if the links keep changing over time (perhaps dynamically using some script), then I would like that behavior (ie., the beeping sound) to be automatically generated for each link in that page, rather than me having to go in and edit every link manually.
Any way I could use some kind of javascript within a CSS file ? Something like:
a.hover { color=red; Call_function=beep() }
Thanks.
Tue, 2004-08-03 04:44
#1
Changing mouseover behaviour for all links using CSS
Hi ga_acad,
You could use javascript to get all the links and add the onmouseover event to each link in window.onload.
window.onload= function(){
var alla=document.getElementsByTagName("A");
for (i=0; i<alla.length; i++) {
/* assign the function to the a */
alla[i].onmouseover=beep();
}
} That should be close.
