Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: swapping images

  1. #1
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    swapping images

    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?

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    give the picture an id
    document.getElementById("picid").src = "me.gif";

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is again an inner HTML suggestion but the thing is I wanna use it in javascript function,

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    that isn't dealing w/ innerHTML, but you could also probably do it w/ this.
    function changePic() {
    document.images["imagename"].src = "me.gif";
    }

  • #5
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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() {

  • #6
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •