View previous topic :: View next topic |
Author |
Message |
FosoFish -
Joined: 23 Apr 2005 Posts: 22
|
Posted: Tue Apr 26, 2005 8:23 pm Post subject: onmouseclick.. |
|
|
How would i make onMouseClick do two things at once? like changing two pictures when it's click, i can't seem to figure it out, thanks! :). |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Tue Apr 26, 2005 9:15 pm Post subject: |
|
|
You need to make a function.
use:
Code: |
<script>
function change(){
document.all.image1.src="image1.jpg";
document.all.image2.src="image2.jpg";
}
</script>
<img src="image.jpg" name="image1">
<img src="image.jpg" name="image2">
<input type="button" onMouseClick="change()">
|
This code is from the top of my head so it may not work but something along those lines!
Hope this helps.[/code] _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
FosoFish -
Joined: 23 Apr 2005 Posts: 22
|
Posted: Tue Apr 26, 2005 9:20 pm Post subject: |
|
|
Doh! Thanks a bunch! |
|
Back to top |
|
 |
FosoFish -
Joined: 23 Apr 2005 Posts: 22
|
Posted: Tue Apr 26, 2005 9:38 pm Post subject: |
|
|
Quick question : Code: |
<script language="JavaScript">
var randomnumber=Math.floor(Math.random()*11)
var msg = new Array();
msg[1] = "pictures/banner/first.png";
msg[2] = "pictures/banner/second.png";
msg[3] = "pictures/banner/third.png";
msg[4] = "pictures/banner/fourth.png";
msg[5] = "pictures/banner/fifth.png";
msg[6] = "pictures/banner/sixth.png";
msg[7] = "pictures/banner/seventh.png";
msg[8] = "pictures/banner/eight.png";
msg[9] = "pictures/banner/nineth.png";
msg[10] = "pictures/banner/tenth.png";
function write() {
document.write(msg[randomnumber]);
}
function change() {
document.all.brn.src=write();
}
</script> |
Image code is :
Code: |
<a href = "#" onMouseOver=change();onMouseOut="bnr.src='pictures/banner/banner.png'"><img src = "pictures/banner/banner.png" name = "bnr" border = 0 over2 = Write;> |
What i want is the image to have a random mouseover image everytime you put the mouse over. What really happens is it goes to a blank page saying the picture name. What am i doing wrong in the OnMouseOver? |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Apr 27, 2005 12:27 pm Post subject: |
|
|
FooFish,
The code has a lot of syntax errors. Do not forget to enclose tags between " and ". What is over2???
Try the following fixed HTML code:
Code: |
<a href = "#" onMouseOver="change();" onMouseOut="bnr.src='pictures/banner/banner.png'"><img src = "pictures/banner/banner.png" name = "bnr" border = "0"></a> |
_________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
|