Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell display drive driver drivers email error ethernet excel firefox firefox 3 hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition password problem router slow software sound trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Drop Down


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
GUSMAN's Avatar
Senior Member with 721 posts.
 
Join Date: Dec 2001
Location: WALES
01-May-2007, 09:28 AM #1
Drop Down
Hi
Can someone show me the code for a drop down menu that will take me to a site when I choose an option from it, or open a file on my pc.

Cheers

Gus
Sequal7's Avatar
Computer Specs
Distinguished Member with 2,369 posts.
 
Join Date: Apr 2001
Location: Around the corner!
Experience: Including today?
01-May-2007, 12:17 PM #2
THis is a simple drop down form element, do you mean a menu or a form?
As far as opening a file on your computer no to both...(for obvious reasons of security it is not able to be parsed)

Add this to the <head></head> section of the page;
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- // Selectable Menu

function load1(form) {
     var url = form.Llist_1.options[form.Llist_1.selectedIndex].value;
     if (url != '') location.href = url;
     return false;
}
// -->
</SCRIPT>
Then the dropdown menu is this;
Code:
<form name="menu">
              <font size="3">Please</font> 
              <select name="Llist_1" onChange="load1(this.form)">
                <option value="" selected>Choose 
                <option value="location/to/link/1.htm">Link to 1 
                <option value="location/to/link/2.htm">Link to 2 
                <option value="location/to/link/3.htm">Link to 3 
              </select>
your location
            </form>
You can see this sample here

Cheers!
__________________
Good Luck on your fix

My real hobby..JoyCo
My real Job..(Second Hobby) IAFF Local 1865
Like the sites? My hobby is the one that created them!

Last edited by Sequal7 : 01-May-2007 12:28 PM.
GUSMAN's Avatar
Senior Member with 721 posts.
 
Join Date: Dec 2001
Location: WALES
01-May-2007, 02:12 PM #3
worked great just one thing how do I get the pages to open on a new page I tried Target = "blank" but no joy

Thanks so much for your help

Gus
Sequal7's Avatar
Computer Specs
Distinguished Member with 2,369 posts.
 
Join Date: Apr 2001
Location: Around the corner!
Experience: Including today?
01-May-2007, 05:57 PM #4
Ahh, frames and targets make it a little more complicated;

Try this then; again, this goes in your <head> </head> area;
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- // Dropdown menu code with targets 

//define the class
function Menu(entered)
{
with (entered)
{
//  basic code to get the inputs
ref=options[selectedIndex].value;

//  look for the the "&" inclusion to define a frame or target 
splitcharacter=ref.lastIndexOf("&");

//  tell it what to do
if (splitcharacter!=-1) {loc=ref.substring(0,splitcharacter); target=ref.substring(splitcharacter+1,1000).toLowerCase();}

//define the same page and target attributes
else {loc=ref; target="_self";};
lowloc=loc.toLowerCase();

//else define a target inclusion
if (lowloc=="false") {return;}

//  different types of targets inclusing frames!
if (target=="_self") {document.location=loc;}
else {if (target=="_top") {top.location=loc;}
      else {if (target=="_blank") {window.open(loc);}
           else{if (target=="_parent") {parent.location=loc;}
               else {parent.frames[target].location=loc;};
               }
           }
     }
}
}
</script>
and this is a sample of the menu with the changes, notice the addition of the "&frame" or "&_target" attributes now
Code:
<form name="menu_targeted">
              <font size="3">Please</font> 
              <select onChange="Menu(this)" name="D1">
                <option value="" selected>Choose 
                <option value="links/1.htm&_blank">link 1 
                <option value="links/2.htm&top">link 2 
                <option value="links/3.htm&_self">link 3 
              </select>
your location
</form>
You can view the first link int he sample I provided above, I have made it open in a new page!
__________________
Good Luck on your fix

My real hobby..JoyCo
My real Job..(Second Hobby) IAFF Local 1865
Like the sites? My hobby is the one that created them!
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:51 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.