Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 2362 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Creating an option menu.

Thread title: Creating an option menu.
Closed Thread    
    Thread tools Search this thread Display Modes  
01-03-2006, 11:06 PM
#1
Jordan Street is offline Jordan Street
Status: Member
Join date: Dec 2005
Location: Tampa Fl
Expertise:
Software:
 
Posts: 214
iTrader: 0 / 0%
 

Jordan Street is on a distinguished road

Send a message via AIM to Jordan Street Send a message via MSN to Jordan Street

  Old  Creating an option menu.

Hey I would like to create a drop down menu with various options then once you select the option you click the go box next to it. Then it would display the information located in a .html document a the content area. Any help is much appreciated.

Thanks,
Jordan

01-03-2006, 11:08 PM
#2
seen.to is offline seen.to
seen.to's Avatar
Status: unusual suspect ™
Join date: Feb 2005
Location: Lancaster, PA from London UK
Expertise:
Software:
 
Posts: 1,814
iTrader: 0 / 0%
 

seen.to is on a distinguished road

  Old

This could be done with Javascript... Not quite sure how but it may help your search to know this

01-03-2006, 11:29 PM
#3
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

Heres some code I quickly whipped up for you to use.

HTML Code:
<form action="#">
	<select>
		<option selected>Choose a destination</option>
		<option value="http://www.site.com/file1.html">Menu One</option>
		<option value="http://www.site.com/file2.html">Menu Two</option>
		<option value="http://www.site.com/file3.html">Menu Three</option>
		<option value="http://www.site.com/file4.html">Menu Four</option>
		<option value="http://www.site.com/file5.html">Menu Five</option>
	</select>

	<input type="button" value="Go" onClick="window.open(this.options[this.selectedIndex].value,'myContent');">
</form>
Then just create an iFrame, or frame with name="myContent" and when someone selects an item from the window and clicks Go the url will be loaded in that frame or iFrame.

Just remember to change http://www.site.com/file.html to what page you want to load for each link.

01-03-2006, 11:33 PM
#4
seen.to is offline seen.to
seen.to's Avatar
Status: unusual suspect ™
Join date: Feb 2005
Location: Lancaster, PA from London UK
Expertise:
Software:
 
Posts: 1,814
iTrader: 0 / 0%
 

seen.to is on a distinguished road

  Old

Originally Posted by joe
Heres some code I quickly whipped up for you to use.

HTML Code:
<form action="#">
	<select>
		<option selected>Choose a destination</option>
		<option value="http://www.site.com/file1.html">Menu One</option>
		<option value="http://www.site.com/file2.html">Menu Two</option>
		<option value="http://www.site.com/file3.html">Menu Three</option>
		<option value="http://www.site.com/file4.html">Menu Four</option>
		<option value="http://www.site.com/file5.html">Menu Five</option>
	</select>

	<input type="button" value="Go" onClick="window.open(this.options[this.selectedIndex].value,'myContent');">
</form>
Then just create an iFrame, or frame with name="myContent" and when someone selects an item from the window and clicks Go the url will be loaded in that frame or iFrame.

Just remember to change http://www.site.com/file.html to what page you want to load for each link.
I think you could do that with onselect as well to bypass the button.

01-03-2006, 11:41 PM
#5
Jordan Street is offline Jordan Street
Status: Member
Join date: Dec 2005
Location: Tampa Fl
Expertise:
Software:
 
Posts: 214
iTrader: 0 / 0%
 

Jordan Street is on a distinguished road

Send a message via AIM to Jordan Street Send a message via MSN to Jordan Street

  Old

Yeah you could but I actually want the button. Thanks for the code man Also instead of an iframe could you just make a <div name="mycontent"> ?

01-03-2006, 11:48 PM
#6
.Nick is offline .Nick
.Nick's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 1,159
iTrader: 3 / 100%
 

.Nick is on a distinguished road

  Old

Put this between the head tags of your page:
Code:
<script type="text/javascript">
function load() {
    var element = document.getElementById('myDiv');
    var form = document.getElementById('myForm');
    var url = form.mySelect.options[mySelect.selectedIndex].value;
    element.innerHTML = '<p><em>Loading ...</em></p>';
    xmlhttp.open("GET", url);
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            element.innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null);
}
</script>
And then use
HTML Code:
<form action="#" id="myForm">
	<select id="mySelect">
		<option selected>Choose a destination</option>
		<option value="http://www.site.com/file1.html">Menu One</option>
	</select>
	<input type="button" value="Go" onClick="load();">
</form>
<div id="myDiv">
I'm going to get replaced with the contents of an html file
</div>
This should work with a div =)

01-03-2006, 11:57 PM
#7
Jordan Street is offline Jordan Street
Status: Member
Join date: Dec 2005
Location: Tampa Fl
Expertise:
Software:
 
Posts: 214
iTrader: 0 / 0%
 

Jordan Street is on a distinguished road

Send a message via AIM to Jordan Street Send a message via MSN to Jordan Street

  Old

Awsome thanks

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed