View Full Version : band site image switch

06-17-2004, 04:20 AM
I barely know any javascript and I really need some help. I copied a script off Draac.com but it doesn't quite apply to my situtation. What I need is a script that changes one image to another when you mouse over a different image. Along the left side of my page I will have headshots of each bandmember, and when you mouse over each person's picture, their bio should come up on the right. At least...that's what I want. There are six people in my band, including me. If possible I'd also like to have an image that's there when you don't have your mouse over a "trigger picture", as I've been calling it. Each bio is saved as one image, not text. I've gotten that far but I really only know HTML and I don't think that covers this. Anyway, if someone could please please please help me out, I'd be eternally grateful. If you need more information please post!

06-17-2004, 04:36 AM
<script type="text/javascript">
function preloadBio(){
var arrBio = new Array("member1_bio.gif","member2_bio.gif","member3_bio.gif");//add as many images
var preload = new Array();
for (var i=0;arrBio.length;i++){
preload[i] = new Image();
preload[i].src = arrBio[i];

function displayBio(name){
<body onload="preloadBio()">
<img src="member1.gif" onmouseover="displayBio('member1')" />
<img src="member2.gif" onmouseover="displayBio('member2')" />
<img src="member3.gif" onmouseover="displayBio('member3')" />
<img name="bio" src="member1_bio.gif" />

As you notice in the code, you should follow a naming convention to associate a band member image to his corresponding bio image.
If a member's image is member1.gif, his bio image should be named member1_bio.gif.

06-17-2004, 05:17 AM
Thanks so much! It worked perfectly...now I just need to get everyone else to submit their bios and pictures and it'll be finished.