PDA

View Full Version : Drop-down Document Viewer (internal document)



Godchaser88
06-24-2008, 02:48 AM
1) Script Title: Drop-down Document Viewer

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/dropdownview.htm

3) Describe problem:

This script looks like it will work well on my site, but instead of the selections pointing to outside, external websites, will it allow me to open up html content instead of a url? Like a form? Maybe this isn't the right script for that, but I like the concept. If you know of how to make this work with the script, or a better way to accomplish my goal, I would appreciate your input.

Thanks.

rangana
06-24-2008, 04:17 AM
You might find this example useful:


<script type="text/javascript">
window.onload=function()
{
var opt=document.getElementById('myselect'), // id of your combo-box (drop-down list)
df=document.forms;
reset();
opt.onchange=function()
{
switch(this.value)
{
case this.value:
reset();
df[this.value].style.display='';
break;
}
}
}
function reset()
{
var df=document.forms;
for(var i=0;i<df.length;i++){df[i].style.display='none';}
}
</script>
<label>Choose what form you wish to view: </label>
<!--Values should depict on which form you want to show, 0 as the first form-->
<select id="myselect">
<option selected>No form choosen yet</option>
<option value="0">Form 1</option>
<option value="1">Form 2</option>
<option value="2">Form 3</option>
<option value="3">Form 4</option>
<option value="4">Form 5</option>
</select>
<!-- This is where form 1 starts ---------------------------------->
<form action="#" method="#">
This is form 1
<input type="text" value="textbox for form1">
<input type="checkbox">
<input type="radio">
<input type="button" value="this is a button for form1">
<input type="submit">
</form>
<!---------------------End of form 1---------------------------->
<!-- This is where form 2 starts ---------------------------------->
<form action="#" method="#">
This is form 2
<input type="text" value="textbox for form2">
<input type="checkbox">
<input type="radio">
<input type="button" value="this is a button for form2">
<input type="submit">
</form>
<!---------------------End of form 2---------------------------->
<!-- This is where form 3 starts ---------------------------------->
<form action="#" method="#">
This is form 3
<input type="text" value="textbox for form3">
<input type="checkbox">
<input type="radio">
<input type="button" value="this is a button for form3">
<input type="submit">
</form>
<!---------------------End of form 3---------------------------->
<!-- This is where form 4 starts ---------------------------------->
<form action="#" method="#">
This is form 4
<input type="text" value="textbox for form4">
<input type="checkbox">
<input type="radio">
<input type="button" value="this is a button for form4">
<input type="submit">
</form>
<!---------------------End of form 4---------------------------->
<!-- This is where form 5 starts ---------------------------------->
<form action="#" method="#">
This is form 5
<input type="text" value="textbox for form5">
<input type="checkbox">
<input type="radio">
<input type="button" value="this is a button for form5">
<input type="submit">
</form>
<!---------------------End of form 5---------------------------->