Results 1 to 2 of 2

Thread: Drop Down Box that navigates with a java script

  1. #1
    Join Date
    Dec 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Drop Down Box that navigates with a java script

    In an earlier thread here I needed to have a text box redirect based on it's input. A javascript was made to take the input from the text box and redirect the browser to the corresponding site. I would like to use that file with a drop down box as well.

    welcome.html
    Code:
    <html>
    <head>
    <script type="text/javascript" src="nums.js"></script>
    </head>
    
    <body>
    <table border="0" cellpadding="0" cellspacing="0">
    	<tr>
    		<td>
    <div class="script">
    <form action="#" onsubmit="gotoit(this.elements[0].value);return false;">
    		<select>
    <option>Select your location</option>
    <option value="00">Support</option>
    <option value="01">Home</option>
    		</select>
    <input type="submit" value="Go">
    </div>
    </td>
    	</tr>
    </table>
    </form>
    </body>
    </html>
    num.js

    Code:
    function gotoit(num){
    if (num=="00")
     window.location="http://www.thedomain.com/support.html";
    if (num=="01")
     window.location="http://www.thedomain.com/";
    }
    document.write('<style type="text/css">.noscript {display:none;}.script{display:block;}<\/style>');
    I understand I may need to add code to the above script for the new function, but I would like to preserve it's current function and use the same numbers for the new function.

    Thanks
    Last edited by whoknowswhat; 12-30-2007 at 08:20 PM. Reason: code error

  2. #2
    Join Date
    Dec 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Nevermind

    My code works, I had an error in the value that did not match the number in the js

Bookmarks

Posting Permissions

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