Web Design Question

Discussion in 'General Discussion' started by SponX, Jan 21, 2005.

  1. SponX

    SponX Well-Known Member

    Age:
    39
    Posts:
    2,332
    Likes Received:
    0
    Joined:
    Nov 30, 2004
    Location:
    HypedGaming.com
    Hey all. I am trying to make a website and I have this kinda code in it.

    <TD WIDTH=252 HEIGHT=167 COLSPAN=12 ROWSPAN=3 align="center" valign="middle" background="images/spacer.gif" bgcolor="#E0E0E0">
    <select name="select" size="8" style="width:200">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>
    <option>9</option>
    <option>10</option>
    <option>11</option>
    <option>12</option>
    <option>13</option>
    </select></TD>

    Now If someone came to my site and selected lets say <option>1</option> which would only show as 1 duh :P but if they selected that and they double clicked that selection... How could I make <option>1</option> link to lets say index-2.html... Please help me.. If you help me and its what I need ill give you 35 credits... :)


    Thanks all

    - Brian
     
  2. SponX

    SponX Well-Known Member

    Age:
    39
    Posts:
    2,332
    Likes Received:
    0
    Joined:
    Nov 30, 2004
    Location:
    HypedGaming.com
    Just bumpin.. I need this help so im going to make it stand out all cool :)
     
  3. Rees

    Rees Member

    Posts:
    24
    Likes Received:
    0
    Joined:
    Jan 4, 2005
    Me and my 2 friends tried to get a general script which would do what you are looking for. If you need any changes or dont understand the code. Then feel free to ask any questions.

    Code:
    <html>
    <head>
      <title>JavaScript Jump Menu</title>
    
    <script language="JavaScript"> 
    function JumpTo( form ) { 
    	var link = form.target.selectedIndex; 
    	if ( link > 0 ) { 
      url = form.target.options[ link ].value; 
      window.location.assign( url ); 
    	} 
    } 
    </script> 
    </head>
    <body>
    
    <form name="jumpbox"> 
    <select id="target" size="1" onChange="JumpTo( this.form )"> 
      <option>Jump To </option>
      <option value=http://logicrises.co.uk>Logic Rises</option> 
      <option value=http://google.co.uk>Google</option> 
    </select>
    </form>
    
    </body>
    </html>
    
    Regards
    Rees
     
  4. Guinness70

    Guinness70 Well-Known Member

    Posts:
    3,285
    Likes Received:
    0
    Joined:
    Aug 5, 2004
    Location:
    Limburg, Belgium
    nice script and its works
    but you can do it with far less code

    the only line you need to add is the following and you add that to the <select> tag
    Code:
    onChange="if(this.value!='')window.location=this.value;"
    Code:
    <html>
    <head>
     <title>Shortest JavaScript Jump Menu</title>
    </head>
    <body>
    
    <form> 
    <select size="8" onChange="if(this.value!='')window.location=this.value;"> 
     <option >Jump To </option>
     <option value=http://logicrises.co.uk>Logic Rises</option> 
     <option value=http://google.co.uk>Google</option> 
     <option value=http://www.gamerenders.com>GameRenders</option> 
    </select>
    </form>
    
    </body>
    </html>
     
  5. Abet

    Abet Senior Member

    Posts:
    4,338
    Likes Received:
    0
    Joined:
    Oct 9, 2004
    both scripts work but I believe that guiness is the way that i use :)
     

Share This Page