whoknowswhat
12-30-2007, 08:19 PM
In an earlier thread here (http://www.dynamicdrive.com/forums/showthread.php?t=27738) 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
<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
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
welcome.html
<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
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