2lick
07-18-2006, 05:56 PM
1) Script Title: Drop Down Menu w/ Descriptions
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/combodescribe.htm
3) Describe problem: I have this drop down menu.
http://www.dynamicdrive.com/dynamicindex1/combodescribe.htm
I would like to have some links open im my frame named (iframe1), and some ina newwin. The newwin works. I noticed the jumptolink code below and the is a if statment for (newwin). Maybe I need to add a id statment for (iframe1) and then tell it what to do. If any one knows what to write or if this is the wrong aproach, PLEASE HELP!!!
I have the code customized to look like this (my actual code):
<!--Drop Down Menu-->
<form name="form1" method=>
<select name="select1" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')">
<option selected value="home.html" >Home</option>
<option>-----------</option>
<option value="foodservices/cafmenutemplate.htm" >Lunch Menu</option>
<option value="http://wired.com">Parents</option>
<option value="http://www.news.com" >Teacher Mail</option>
<option value="https://staff.west.org" target="newwin" >WCCS Secured</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>
and the other part:
<!-- Code For Drop Down Quik Links -->
<script type="text/javascript">
/***********************************************
* Drop down menu w/ description- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
//1) CUSTOMIZE TEXT DESCRIPTIONS FOR LINKS ABOVE
var thetext1=new Array()
thetext1[0]=""
thetext1[1]=""
thetext1[2]=""
thetext1[3]=""
thetext1[4]=""
thetext1[5]=""
function displaydesc(which, descriptionarray, container){
if (document.getElementById)
document.getElementById(container).innerHTML=descriptionarray[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')
</script>
I am preaty new too all of this but I searched every where and I cant seem to get it to work.
THANK YOU ALL!!!
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/combodescribe.htm
3) Describe problem: I have this drop down menu.
http://www.dynamicdrive.com/dynamicindex1/combodescribe.htm
I would like to have some links open im my frame named (iframe1), and some ina newwin. The newwin works. I noticed the jumptolink code below and the is a if statment for (newwin). Maybe I need to add a id statment for (iframe1) and then tell it what to do. If any one knows what to write or if this is the wrong aproach, PLEASE HELP!!!
I have the code customized to look like this (my actual code):
<!--Drop Down Menu-->
<form name="form1" method=>
<select name="select1" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')">
<option selected value="home.html" >Home</option>
<option>-----------</option>
<option value="foodservices/cafmenutemplate.htm" >Lunch Menu</option>
<option value="http://wired.com">Parents</option>
<option value="http://www.news.com" >Teacher Mail</option>
<option value="https://staff.west.org" target="newwin" >WCCS Secured</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>
and the other part:
<!-- Code For Drop Down Quik Links -->
<script type="text/javascript">
/***********************************************
* Drop down menu w/ description- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
//1) CUSTOMIZE TEXT DESCRIPTIONS FOR LINKS ABOVE
var thetext1=new Array()
thetext1[0]=""
thetext1[1]=""
thetext1[2]=""
thetext1[3]=""
thetext1[4]=""
thetext1[5]=""
function displaydesc(which, descriptionarray, container){
if (document.getElementById)
document.getElementById(container).innerHTML=descriptionarray[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')
</script>
I am preaty new too all of this but I searched every where and I cant seem to get it to work.
THANK YOU ALL!!!