onmouseclick..

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
FosoFish
-


Joined: 23 Apr 2005
Posts: 22

PostPosted: Tue Apr 26, 2005 8:23 pm    Post subject: onmouseclick.. Reply with quote

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 View user's profile Send private message Visit poster's website
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Tue Apr 26, 2005 9:15 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
FosoFish
-


Joined: 23 Apr 2005
Posts: 22

PostPosted: Tue Apr 26, 2005 9:20 pm    Post subject: Reply with quote

Doh! Thanks a bunch!
Back to top View user's profile Send private message Visit poster's website
FosoFish
-


Joined: 23 Apr 2005
Posts: 22

PostPosted: Tue Apr 26, 2005 9:38 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Apr 27, 2005 12:27 pm    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group