View Full Version : swapping images
pinkcat_02
01-15-2003, 12:57 AM
I wanna ask the question about swapping the images.
If we assume that I have an image in a layer called 'me'. If i wanna replace this image with another image called 'sam', what shall i use to replace 'me' with 'sam'
i know i can't say
me='sam.gif'
is there a simple way of doing this?
chrismiceli
01-15-2003, 12:58 AM
give the picture an id
document.getElementById("picid").src = "me.gif";
pinkcat_02
01-15-2003, 02:25 AM
this is again an inner HTML suggestion but the thing is I wanna use it in javascript function, :confused:
chrismiceli
01-15-2003, 03:16 AM
that isn't dealing w/ innerHTML, but you could also probably do it w/ this.
function changePic() {
document.images["imagename"].src = "me.gif";
}
pinkcat_02
01-15-2003, 12:32 PM
<script language="JavaScript" type="text/JavaScript">function mmLoadMenus() {
if (window.mm_menu_0115121908_0) return;
window.mm_menu_0115121908_0 = new Menu("root",40,18,"",12,"#000000","#FFFFFF","#CCCCCC","#000084","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
mm_menu_0115121908_0.addMenuItem("on","function changePic() {
document.images["image1"].src = "me.gif";
}
");
i tried to put it in another java script like this but it is not working do you know how to put it in here?
<script language="JavaScript" type="text/JavaScript">function mmLoadMenus() {
pinkcat_02
01-15-2003, 12:33 PM
<script language="JavaScript" type="text/JavaScript">function mmLoadMenus() {
if (window.mm_menu_0115121908_0) return;
window.mm_menu_0115121908_0 = new Menu("root",40,18,"",12,"#000000","#FFFFFF","#CCCCCC","#000084","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
mm_menu_0115121908_0.addMenuItem("on","function changePic() {
document.images["image1"].src = "me.gif";
}
");
i tried to put it in another java script like this but it is not working do you know how to put it in here?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.