This is the complete code with HTML to create drop down menus with some random links.
And the javascript ofc.
Cheers!!!
<!--TRY THIS-->
<form name="form1">
<select name="select1" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')">
<option selected value="http://www.freelancegossip.com">FG Forum </option>
<option value="www.google.com">Google</option>
<option value="http://tftb.net" rel="nofollow" target="newwin">Tech FanaTic Blog</option>
<option value="http://techcrunch.com">Tech Crunch</option>
</select>
<input type="button" value="Go"
onClick="jumptolink(document.form1.select1)"><br>
<span id="textcontainer1" align="left" style="font:italic 13px Arial">
</span>
</form>
var thetext1=new Array()
thetext1[0]="TRY IT AND TELL ME"
thetext1[1]="FG Forums-Gossip Like Freelancer"
thetext1[2]="The Tech Blog."
thetext1[3]="Tech Crunch"
<script type="text/javascript">
function displaydesc(which, descriptionarray, container){
if (document.getElementById)
document.getElementById(container).innerHTML=descr iptionarray[which.selectedIndex]
}
function jumptolink(what){
var selectedopt=what.options[what.selectedIndex]
if (document.getElementById && selectedopt.getAttribute("target")=="newwin")
window.open(selectedopt.value)
else
window.location=selectedopt.value
}
displaydesc(document.form1.select1, thetext1, 'textcontainer1')
displaydesc(document.form2.select2, thetext2, 'textcontainer2')
</script>
|