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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Location
    UK
    Posts
    207
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Jump menu query... probably obvious...

    Hi...

    I have this code which works well, but rather than buttons (title 1, title 2), I want to achieve the same description change using a jump menu.

    I'm pulling my hair out trying to work it out and i'm sure it's simple.

    Thanks

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html>
    
    <head>
    
    
    <script type="text/javascript">
    function PopUp(mesid,txt){
     var messobj=document.getElementById(mesid);
     messobj.innerHTML=txt;
    }
    </script>
    
    <title>
    test
    </title>
    
    </head>
    
    <body>
    
    
    <a href="#" onclick="PopUp(
    'caption','Description 1');">
    Title 1</a>
    
    <a href="#" onclick="PopUp(
    'caption','Description 2');">
    Title 2</a>
    
    <br /><br />
    <div id="caption">The description will go here...</div>
    
    
    </body>
    
    </html>

  • #2
    Regular Coder
    Join Date
    Dec 2005
    Location
    UK
    Posts
    207
    Thanks
    6
    Thanked 2 Times in 2 Posts
    i worked it out...

    Code:
    <form id="form1">
      <select name="menu1" onchange="PopUp('caption',value);">
        <option>unnamed1</option>
        <option value="twat">unnamed2</option>
        <option value="****">unnamed3</option>
      </select>
    </form>
    
    
    
    <br />
    <br />
    <div id="caption">The description will go here...</div>
    as i said... simple!

  • #3
    Regular Coder
    Join Date
    Dec 2005
    Location
    UK
    Posts
    207
    Thanks
    6
    Thanked 2 Times in 2 Posts
    hmmmm, ok...

    a new problem now though.

    I want to put a link in the description that pops up but this won't let me.

    ie...

    Code:
    <option value="Description here <a href="link.html">with a link</a>Title 1</option>
    Any ideas???

  • #4
    Regular Coder
    Join Date
    Dec 2005
    Location
    UK
    Posts
    207
    Thanks
    6
    Thanked 2 Times in 2 Posts
    ok ok.... worked it out again.

    Code:
    <option value="Description here <a href='link.html'>with a link</a>Title 1</option>


  •  

    Posting Permissions

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