Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript image changer

Status
Not open for further replies.

cameronpierson

Technical User
Apr 16, 2008
4
GB
Hey, i want to create a kind of game thing where there are lots of white circles [images] arranged in a grid with 6 coloured circles [images] underneath [white black red blue yellow green]

and the user clicks a coloured circle at the bottom, then any of the white circles in the grid changes to that colour when clicked.

i have absolutely no idea how to do this but i assume i could be done some how?

please help
 
How many points is the assignment worth?


Teachers always assigned the games near the end of the semester. Fun times.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
its not an assignment, its for personal use.

do you know how to do it?
 
dont worry, ive done it

<body bgcolor="#333333">

<p><a onclick="change()"><img border="0" src="white.jpg" width="20" height="20" id="im"></a></p>

<SCRIPT LANGUAGE="JavaScript">


function change() {
document.getElementById("im").src=image
}
</SCRIPT>

<p><a onClick="image='black.jpg'"><img border="0" src="black.jpg" width="20" height="20"></a>
<a onClick="image='white.jpg'"><img border="0" src="white.jpg" width="20" height="20"></a>
<a onClick="image='red.jpg'"><img border="0" src="red.jpg" width="20" height="20"></a>
<a onClick="image='blue.jpg'"><img border="0" src="blue.jpg" width="20" height="20"></a>
<a onClick="image='green.jpg'"><img border="0" src="green.jpg" width="20" height="20"></a>
<a onClick="image='yellow.jpg'"><img border="0" src="yellow.jpg" width="20" height="20"></a></p>
</BODY>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top