Using onmousedown and onmouseup for the .getElementsByClassName method
I have a class of links defined as .button, they are highly stylized and look like links. I want to set it so that
onmousedown, the background color and border style will change, and will change back to what they were onmouseup. Currently I have functions defined as mDown(x) and mUp(x), where I use x as the parameter and then change them to mDown(this) and mUp(this) as onmousedown and onmouseup attributes of every button. I was wondering if there is a way to set the onmousedown and onmouseup actions for the class as a whole. By the way, in the below code the
element with ID "box" is the table cell in which all of the buttons are located. I was thinking something like this:
No, you'll have to set the onmousedown and onmouseup on all elements individually, which is easily achieved with a loop. getElementsByClassName returns an array.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread