Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box with one selection special

Status
Not open for further replies.

royyan

Programmer
Jul 18, 2001
148
US
I have a combo box with a list of options. I would like to have the last selection "Choose More..." as a link. It will load a page to provide more options when user select it. All other options will remain as normal selection.
Thanks!
 
I don't think you can put a link inside a combobox. What you can do is popup another window onChange event.

Something like:
<form name="f1" method="post" action="next.asp">
<select name="myCombo" size="1" onChange="popupMore()">
<option value="more">Choose More...</option>
....other options...
</select>
</form>

<script language="javascript">
function popupMore(){
if (document.f1.myCombo.value=="more"){
window.open("balb blab...)
//or do something else
}
}
</script>

 
You can simulate a link thru your dropdown using kendel's suggestion. All you have to do is change his window.open to window.location = 'someNewPage.html'

-kaht

banghead.gif
 
What I am trying to do is load page to another frame which is similar you generate a pop up page. I actually have some JavaScript code to do this. But somehow it has problem when I select other options such as Yellow, Green. See code below.
<code>
function select1_onchange() {
if(form.select1[searchform.select1.selectedIndex]..value = " parent.mainFrame.location = form.select1.options[searchform.select1.selectedIndex].value;
}


<select id=select1 name=select1 size="1" LANGUAGE=javascript onchange="return select1_onchange()">
<option value="Yellow">Yellow</option>
<option value="Green">Green</option>
<option value="Red">Red</option>
<option value=" More...</option>
</select>

</code>
Can anybody help me figure out what is wrong? Thanks!
 
Ok, I figure out my previous code problem. I should use
if(form.select1[searchform.select1.selectedIndex]..value == "instead of
if(form.select1[searchform.select1.selectedIndex]..value = "Thank you both all the same!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top