Results 1 to 2 of 2

Thread: Drop-down Document Viewer (internal document)

  1. #1
    Join Date
    Jun 2008
    Location
    WV
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Drop-down Document Viewer (internal document)

    1) Script Title: Drop-down Document Viewer

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...opdownview.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.

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    You might find this example useful:
    HTML Code:
    <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---------------------------->
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •