PDA

View Full Version : multiple onmouseover events



rich1234
03-17-2008, 10:13 PM
Hi,
I would like to have a mouseover event change on each mouseover. For example, each time someone mouseovered a link a different image would appear.
Does anyone know if this is possible?

Any pointers would be a great help.
Thanks
Richard

ddadmin
03-17-2008, 11:06 PM
Hi:
Well in general, you can define multiple onmouseover events (or any event for that matter) by separating each one with a semi colon, something like:


<a href="#" onMouseover="dothis(); dothat()">Test</a>

Jas
03-17-2008, 11:29 PM
If your talking about more of a "random function" on mouseover, you might want to use something like:

<script>
function a_test(){
var number = Math.floor(Math.random()*5);
if(number == 1){
function1();
}else if(number == 2){
function2();
}else if( number ==3){
function3();
}else{
function4();
}
}
</script>

<a href="#" onmouseover="a_test()">click me</a>

John Books
10-06-2008, 05:40 PM
I would like to see that script for onmouseover that continues from
<a href="#" onMouseover="dothis(); dothat()">Test</a>

I would like to change a button, which I can do and change a .jpg elsewhere in the same page as the mouse travels over each menu button. I understand the basics, but this is confusing me.

codeexploiter
10-07-2008, 03:10 AM
You can check a demo page I've posted in the following location - the 2nd reply from the top.

http://www.dynamicdrive.com/forums/showthread.php?t=37323

Hope this helps.