Second IMG not swapping

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default Second IMG not swapping

    Okay, I already have the layer floating properly that contains the two boxes
    and the first box is swapping the pictures properly. However, for some reason,
    the second box refuses to swap pictures.

    Here's the code:



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Equipment Catalog-Belts</title>
    <link href="//.ItemCatalog" rel="stylesheet" type="text/css" />
    <style type="text/css">
    .style213 {font-family: "Monotype Corsiva"; font-size: 20px;}
    .style214 {color: #FFFFFF}
    </style>

    <SCRIPT LANGUAGE="JavaScript">
    Image1= new Image(75,50)
    Image1.src = "/images/FloatBoxStart.jpg"
    Image2 = new Image(75,50)
    Image2.src = "/images/Belts/Belt of Ogre Strength2.jpg"
    Image3 = new Image(75,50)
    Image3.src = "/images/Belts/Belt of the Mighty2.jpg"
    Image4 = new Image(75,50)
    Image4.src = "/images/Belts/Azure Silk Belt2.jpg"
    Image5 = new Image(75,50)
    Image5.src = "/images/Belts/Supply Runner Belt2.jpg"
    Image6 = new Image(75,50)
    Image6.src = "/images/Belts/Black Belt2.jpg"
    Image7 = new Image(75,50)
    Image7.src = "/images/Belts/Glowing Belt2.jpg"
    Image8 = new Image(75,50)
    Image8.src = "/images/Belts/Mushroom Skinned Belt2.jpg"
    Image9 = new Image(75,50)
    Image9.src = "/images/Belts/Goldweave Belt2.jpg"
    Image10 = new Image(75,50)
    Image10.src = "/images/Belts/Small Silk Sash2.jpg"
    Image11 = new Image(75,50)
    Image11.src = "/images/Belts/Wide Silk Sash2.jpg"

    function SwapBack1(){document.InfoBox1.src = Image1.src; return true;}
    function ItemInfo1(){document.InfoBox1.src = Image2.src; return true;}
    function ItemInfo2(){document.InfoBox1.src = Image3.src; return true;}
    function ItemInfo3(){document.InfoBox1.src = Image4.src; return true;}
    function ItemInfo4(){document.InfoBox1.src = Image5.src; return true;}
    function ItemInfo5(){document.InfoBox1.src = Image6.src; return true;}
    function ItemInfo6(){document.InfoBox1.src = Image7.src; return true;}
    function ItemInfo7(){document.InfoBox1.src = Image8.src; return true;}
    function ItemInfo8(){document.InfoBox1.src = Image9.src; return true;}
    function ItemInfo9(){document.InfoBox1.src = Image10.src; return true;}
    function ItemInfo10(){document.InfoBox1.src = Image11.src; return true;}

    function SwapBack2(){document.InfoBox2.src = Image1.src; return true;}
    function ItemInfo1_2(){document.InfoBox2.src = Image2.src; return true;}
    function ItemInfo2_2(){document.InfoBox2.src = Image3.src; return true;}
    function ItemInfo3_2(){document.InfoBox2.src = Image4.src; return true;}
    function ItemInfo4_2(){document.InfoBox2.src = Image5.src; return true;}
    function ItemInfo5_2(){document.InfoBox2.src = Image6.src; return true;}
    function ItemInfo6_2(){document.InfoBox2.src = Image7.src; return true;}
    function ItemInfo7_2(){document.InfoBox2.src = Image8.src; return true;}
    function ItemInfo8_2(){document.InfoBox2.src = Image9.src; return true;}
    function ItemInfo9_2(){document.InfoBox2.src = Image10.src; return true;}
    function ItemInfo10_2(){document.InfoBox2.src = Image11.src; return true;}
    </SCRIPT>
    </head>

    <body background="/images/Background.jpg">
    <div id="InfoBoxLayer" STYLE="position:absolute; visibility:visible; left:
    660px; width: 220px; height: 340px; top: 230;">
    <p><IMG id="InfoBox1" name="InfoBox1" src="/images/FloatBoxStart.jpg"
    width=260 height=150 border="2" onClick="SwapBack1()"></p>
    <p>
    <IMG id="InfoBox2" name="InfoBox2" src="/images/FloatBoxStart.jpg"
    width=260 height=150 border="2" onClick="SwapBack2()"></p>
    </div>

    <script language="JavaScript" type="text/javascript">
    var Layer1='<layer id="InfoBoxLayer" src="/images/FloatBoxStart.jpg"
    width="260px" height="150px" scrolling="no" style="position: absolute; left:
    -500px; top: -500px;">'
    var left="660px"
    var top="230px"

    var ie=(document.all || window.opera) && document.getElementById
    var iebody=(document.compatMode=="CSS1Compat")? document.documentElement :
    document.body

    if (ie)
    document.write(Layer1)

    function positionit(){obj=document.getElementById("InfoBoxL ayer")
    var window_width=ie && !window.opera? iebody.clientWidth : window.innerWidth-20
    window_height=ie && !window.opera? iebody.clientHeight : window.innerHeight
    var dsocleft=ie? iebody.scrollLeft : pageXOffset
    var width=obj.width
    height=obj.height
    obj.style.left=(left=="right")? window_width-width-20 : left
    setInterval("repositionit()", 300)}

    function repositionit(){if (ie){dsoctop=ie? iebody.scrollTop : pageYOffset
    obj.style.top=(top=="bottom")? window_height-height-14+dsoctop :
    parseInt(top)+dsoctop}}

    if (window.attachEvent)
    window.attachEvent("onload", positionit)
    </script>

    <a href="/index.html"><img src="/images/AE%20HQ%20Title%20Banner.png" alt="Go
    Back to the Main Portal" name="TitleBanner" width="641" height="73" border="0"
    id="TitleBanner" /></a>
    <table width="640" border="2" cellpadding="1" cellspacing="1" id="ItemList">
    <tr><th colspan="9" scope="col"><center class="style213"><font
    color="red">EQUIPMENT CATALOG - Ashen Empires </font></center></th></tr>
    <tr>
    <th width="200" scope="col"><span class="style213"><font
    color="red">Belts</font></span></th>
    <th width="80" scope="col"><span class="style213"><font
    color="red">Crafted</font></span></th>
    <th width="150" scope="col"><span class="style213"><font color="red">DEV
    &amp; GM Only </font></span></th>
    <th width="80" scope="col"><span class="style213"><font
    color="red">Drop</font></span></th>
    <th width="100" scope="col"><span class="style213"><font color="red">Quest
    Item </font></span></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Belt of Ogre Strength</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img src="/images/Belts/Belt of Ogre Strength1.jpg"
    onClick="ItemInfo1()" onmouseover="ItemInfo1_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Belt of the Mighty </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image2" src="/images/Belts/Belt of the
    Mighty1.jpg" onClick="ItemInfo2()" onmouseover="ItemInfo2_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Azure Silk Belt </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image3" src="/images/Belts/Azure Silk Belt1.jpg"
    onClick="ItemInfo3()" ondblclick="ItemInfo3_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Supply Runner Belt </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image4" src="/images/Belts/Supply Runner
    Belt1.jpg" onClick="ItemInfo4()" ondblclick="ItemInfo4_2"/></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Black Belt </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image5" src="/images/Belts/Black Belt1.jpg"
    onClick="ItemInfo5()" ondblclick="ItemInfo5_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Glowing Belt </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image6" src="/images/Belts/Glowing Belt1.jpg"
    onClick="ItemInfo6()" ondblclick="ItemInfo6_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Mushroom Skinned Belt </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image7" src="/images/Belts/Mushroom Skinned
    Belt1.jpg" onClick="ItemInfo7()" ondblclick="ItemInfo7_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Goldweave Belt </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image8" src="/images/Belts/Goldweave Belt1.jpg"
    onClick="ItemInfo8()" ondblclick="ItemInfo8_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Small Silk Sash </font></th>
    <th scope="col"><img id="image9" src="/images/Belts/Small Silk Sash1.jpg"
    onClick="ItemInfo9()" ondblclick="ItemInfo9_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Wide Silk Sash </font></th>
    <th scope="col"><img id="image10" src="/images/Belts/Wide Silk Sash1.jpg"
    onClick="ItemInfo10()" ondblclick="ItemInfo10_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;</th>
    </tr>
    <tr>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;</th>
    <th scope="
    Falconwing13 Guest

  2. Similar Questions and Discussions

    1. need help with image swapping.
      hi all need help with image swapping. its perfectly working in my system offline as well as online. but its not showing the image in other...
    2. swapping images
      Hi everyone, I've used dw's timeline and behaviour functions to create a page where images swap over every 3 seconds. It works great in Mozilla...
    3. image swapping in php
      "Richard" <anom@anom> schrieb im Newsbeitrag news:bm50kc0sgn@enews2.newsguy.com... You can't do that. A mouseover event is processed at the...
    4. Swapping images?
      Hello, this is more than likely a newb question, but non the less, I must ask. How does one have an image swap in a portion of a web page via a...
    5. swapping swf
      Hi, Does anyone have any scripts that will swap an swf on a page? Preferably it would use javascript, but anything will do. Even a tutorial would...
  3. #2

    Default Re: Second IMG not swapping

    Any ideas on how to resolve this issue?
    Falconwing13 Guest

  4. #3

    Default Re: Second IMG not swapping

    Alright, I found something intriguing about how the code is working. When I
    change the second image's event commands to the following:

    <tr>
    <th scope="col"><font color="#FFFFFF">Belt of Ogre Strength</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img src="/images/Belts/Belt of Ogre Strength1.jpg"
    onClick="ItemInfo1()" onmouseover="ItemInfo1_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>
    <tr>
    <th scope="col"><font color="#FFFFFF">Belt of the Mighty </font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    <th scope="col"><img id="image2" src="/images/Belts/Belt of the Mighty1.jpg"
    onClick="ItemInfo2_1()" onmouseover="ItemInfo2_2"/></th>
    <th scope="col"><font color="#FFFFFF">X</font></th>
    </tr>

    I am able to make the second image put it's information picture into the
    second box with the onClick event and the first image is able to put its
    information picture into the first box using the onClick event.

    So it appears that for some reason, the second event command is not being
    allowed to work.

    Any suggestions on how to fix this?

    Falconwing13 Guest

  5. #4

    Default Re: Second IMG not swapping

    Okay, finally found the problem (and a silly one at that!). I was missing the parens on the second function calls. Problem fixed by myself :D
    Falconwing13 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139