Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default img change on click help

    Hi this is one thing im not good at. I want the image that is clicked to open the submenu, which works, but when that menu is opened (i.e when image is clicked) i want it to change to another pic, and change back when the submenu is closed.

    HTML Code:
        <img src="1PNG" onclick="SwitchMenu('sub1')" width="189" height="26" img src="2.PNG"><br>
        <span class="submenu" id="sub1">
            - Home<br>
            - What's New<br>
            </span>
    +rep thanks !!
    no

  2. #2

    Default

    HTML Code:
    <img src="1PNG" name="1" onclick="SwitchMenu('sub1'); document.1.src='new.png';" width="189" height="26" img src="2.PNG"><br>
        <span class="submenu" id="sub1">
            - Home<br>
            - What's New<br>
            </span>
    That should work? I don't know about changing it back, I'm useless with javascript.

  3. #3
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default

    nup. +rep for trying
    no

  4. #4
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    In head..
    HTML Code:
    <script type="text/javascript">
    function swim()
    {
    if(switchcount==0)
    {
    document.getElementById("1").src = 'IMAGE WHEN CLICKED';
    switchcount = 1;
    }
    else
    {
    document.getElementById("1").src = 'ORIGINAL IMAGE';
    switchcount = 0;
    }
    }
    </script>

    Then replace your code with this..
    HTML Code:
    <img src="1PNG" onclick="SwitchMenu('sub1'); swim();" width="189" height="26" img src="2.PNG" id="1"><br>
        <span class="submenu" id="sub1">
            - Home<br>
            - What's New<br>
            </span>
    Coming and going...
    Highers are getting the better of me

  5. #5
    Join Date
    Jan 2008
    Posts
    3,711
    Tokens
    100

    Latest Awards:

    Default

    Quote Originally Posted by MrCraig View Post
    In head..
    HTML Code:
    <script type="text/javascript">
    function swim()
    {
    if(switchcount==0)
    {
    document.getElementById("1").src = 'IMAGE WHEN CLICKED';
    switchcount = 1;
    }
    else
    {
    document.getElementById("1").src = 'ORIGINAL IMAGE';
    switchcount = 0;
    }
    }
    </script>

    Then replace your code with this..
    HTML Code:
    <img src="1PNG" onclick="SwitchMenu('sub1'); swim();" width="189" height="26" img src="2.PNG" id="1"><br>
        <span class="submenu" id="sub1">
            - Home<br>
            - What's New<br>
            </span>
    I think he's right.. Lol. I dunno... +rep to you

Posting Permissions

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