...

View Full Version : Drop Down Menu With Iframes



Crystalclouds
10-10-2003, 11:23 PM
Im Still kinda new to Scripts etc So please be nice :D

Basically i want a simple drop down menu (like that dreamweaver creates) That lets me open the links into the iframe

Ive searched around and cant seem to solve the problem ???

Thx in advance for you help guys!

Basscyst
10-11-2003, 12:42 AM
This should work.

Code:

\\This one goes to the site when the user changes the dropdown menu.

<html>
<head>
<script language="javascript">

function formhandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.content.location.href=URL;
}

</script>
</head>
<body>
<form name="form">
<select name="site" onchange="formhandler(form);">
<option>Select A Site. . .
<option value="http://www.codingforums.com">Coding Forums
<option value="http://www.msn.com">MSN
<option value="http://www.yahoo.com">Yahoo
</select>
</form>
<iframe src="" name="content" height=450 width=800></iframe>
</body>
</html>

\\This one goes when you click on the button

<html>
<head>
<script language="javascript">

function formhandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.content.location.href=URL;
}

</script>
</head>
<body>
<form name="form">
<select name="site">
<option>Select A Site. . .
<option value="http://www.codingforums.com">Coding Forums
<option value="http://www.msn.com">MSN
<option value="http://www.yahoo.com">Yahoo
</select>
<input type="button" value="go" onclick="formhandler(form)">
</form>
<iframe src="" name="content" height=450 width=800></iframe>
</body>
</html>

Crystalclouds
10-11-2003, 12:34 PM
Thx for that , and it works :D

Is it also Possible to have the menu in the main window , but to open in an iframe i have already made?????

Basscyst
10-11-2003, 04:15 PM
Yes just put the javascript code in the head of the document. and then set your naming convention the same as what is here ie. name your iFrame "content",your form "form" and your select box "site".

Vincent Puglia
10-12-2003, 05:07 AM
Hi,

<html>
<body>
<form name="form">
<select name="site" onchange="if (this.selectedIndex != 0)content.location=this.options[this.selectedIndex].value">
<option>Select A Site. . .</option>
<option value="http://members.aol.com/grassblad>GrassBlade Javascript</option>
<option value="http://www.webxpertz.net/forums>webXpertz Forums</option>
<option value="http://www.google.com">Google</option>
</select>
</form>
<iframe src="" name="content" height=450 width=800></iframe>
</body>
</html>

Vinny



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum