PDA

View Full Version : Drop-down Document Viewer



emanuelle
06-26-2006, 11:44 AM
http://www.dynamicdrive.com/dynamicindex3/dropdownview.htm

How do I apply to the onchange(url) to go to another page in my site.
Not inline frame and not a new window.

jscheuer1
06-27-2006, 05:10 AM
<form name="jumpy">
<select name="example" size="1" onChange="gone()">
<!-- CHANGE THE BELOW URLS TO YOUR OWN-->
<option value="http://www.yahoo.com" selected>Yahoo.com</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.lycos.com">Lycos</option>
<option value="http://www.AltaVista.com">AltaVista</option>
</select>

<input type="button" name="test" value="Go!" onClick="gone()">
</form>

<script type="text/javascript">

//Drop-down Document Viewer- Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

//Specify display mode (0, 1, or 2)
//0 causes document to be displayed in an inline frame, 1 in a new browser window, 2 in the same window
var displaymode=2
//if displaymode=0, configure inline frame attributes (ie: dimensions, intial document shown
var iframecode='<iframe id="external" style="width:95%;height:400px" src="http://www.yahoo.com"></iframe>'

/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function gone(){
var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=selectedurl
else if (document.all&&displaymode==0)
document.all.external.src=selectedurl
else if (displaymode==2)
window.location=selectedurl
else{
if (!window.win2||win2.closed)
win2=window.open(selectedurl)
//else if win2 already exists
else{
win2.location=selectedurl
win2.focus()
}
}
}

</script>

emanuelle
06-27-2006, 06:51 AM
thank you