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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a dropbox to choose another page? 1

Status
Not open for further replies.

SimonDavis

Technical User
Mar 16, 2001
613
GB
I have a page, where I will put a dropbox.

Under the dropbox is a frame, and I want the contents of the frame to be chosen by selecting from the dropbox (so if I have a list of pages, the user selects one, and it appears in the frame).

I have 2 questions - firstly how do I make the link to the desired page? I can only get the dropbox to send the result chosen to a .txt file, and only then if I click the submit button (i want it to peform the action immediately).

And secondly, can the dropbox be populated from a different source - it looks like a pain to edit the list properties, I'd rather keep a simple table somewhere.

Does that make sense?
Thanks.
 
This is a script that will chnge to the selected page onChange. Not compatible with NN 4.78. I beleive you can add a submit button because you are already enclosing the dropdown between form tags.

This goes in the Head of the page
Code:
<SCRIPT>
<!--
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget==&quot;_self&quot;) {window.location=loc;}
else {if (lowtarget==&quot;_top&quot;) {top.location=loc;}
else {if (lowtarget==&quot;_blank&quot;) {window.open(loc);}
else {if (lowtarget==&quot;_parent&quot;) {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf(&quot;&&quot;);
target=&quot;&quot;;
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target=&quot;_self&quot;;};
if (ref != &quot;&quot;) {land(loc,target);}
}
//-->
</SCRIPT>

<!-- End Template Menu Script-->

This is the form action and dropdown
Code:
<FORM action=dummy method=post>
<SELECT onchange=jump(this.form)
name=&quot;choice&quot;>
<option value=&quot;newPage1.html>Page 1</option>
<option value=&quot;newPage2.html>Page 2</option>
</select>
</form>

It would make sense that you could add a submit button for compatibility

<input type=&quot;submit&quot; onClick=&quot;jump(doument.form.choice);&quot; value=&quot;Go!&quot;> DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Thanks for that. I've put it into my page using Frontpage 2k, but it doesn't seem to work just yet - I've changed the choices to reflect a couple of my pages (index.htm and news.htm), but I only get the 2nd choice showing on the list, and when I select it nothing happens.

Just a quick question, I noticed on the option value= that there is a quote opening, but not closing - could this be a problem, if so, where should I close the quote?

I'll experiment anyway, I think that's about 95% of it solved so I thank you anyway for your help.

 
My appologies [purple]

<option value=&quot;newPage1.html&quot;> DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Thanks a lot for your help. Saved me a new bald spot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top