Drop down list question

S

Steve Grosz

What I'm hoping someone can help me with is this.

I want to create a drop down list, of products, and when the user selects
the appropriate item, have it pull the appropriate info from either a
database or file, and display it in a different frame. How can I do this?
I can get the drop down list to appear, and can add items to the list
itself, but once the item is picked, how can you get data to be displayed
that corresponds to that choice?

Thanks very much!

Steve
 
S

Steve Grosz

I tried to add the code into my html page. What happened was the first line
I entered, the 'function jmp()' then appears on the preview tab. Any ideas
what is going on?

Also, what defines the index, used in (this.selectedIndex) ??

Thanks!
Steve
 
S

Stefan B Rusynko

Insert the tag: <script language="JavaScript" type="text/javascript">
before the line: function jmpMS(site){

PS move the whole script inside of the HEAD tags at the top of the page so you have

<head>
.................... any other tags here

<script language="JavaScript" type="text/javascript">
function jmpMS(site) {
if (site == 0) {return;}
if (site == 1) {parent.frames.myframe.location.href="http://www.microsoft.com/";}
if (site == 2) {parent.frames.myframe.location.href="http://mspress.microsoft.com/";}
if (site == 3) {parent.frames.myframe.location.href="http://www.msnbc.com/";}
}
</script>

</head>

--



| I tried to add the code into my html page. What happened was the first line
| I entered, the 'function jmp()' then appears on the preview tab. Any ideas
| what is going on?
|
| Also, what defines the index, used in (this.selectedIndex) ??
|
| Thanks!
| Steve
|
| | > >-----Original Message-----
| > >What I'm hoping someone can help me with is this.
| > >
| > >I want to create a drop down list, of products, and when
| > >the user selects the appropriate item, have it pull the
| > >appropriate info from either a database or file, and
| > >display it in a different frame. How can I do this?
| > >I can get the drop down list to appear, and can add
| > >items to the list itself, but once the item is picked,
| > >how can you get data to be displayed that corresponds to
| > > that choice?
| > >
| > >Thanks very much!
| > >
| > >Steve
| >
| > add an onChange attribute to your drop-down list, as
| > shown below.
| >
| > <select name="msdest" size="1"
| > onChange="jmpMS(this.selectedIndex)">
| > <option>None</option>
| > <option>Main Home Page</option>
| > <option>Microsoft Press</option>
| > <option>MS-NBC</option>
| > </select>
| >
| > Then, elsewhere in the page, define a script like this:
| >
| > function jmpMS(site){
| > if (site == 0) {
| > return;
| > }
| > if (site == 1) {
| > parent.frames.myframe.location.href =
| > "http://www.microsoft.com/"
| > }
| > if (site == 2) {
| > parent.frames.myframe.location.href =
| > "http://mspress.microsoft.com/"
| > }
| > if (site == 3) {
| > parent.frames.myframe.location.href =
| > "http://www.msnbc.com/"
| > }
| > }
| > </script>
| >
| > where myframe is the name of the target frame.
| >
| > Jim Buyens
| > Microsoft FrontPage MVP
| > (e-mail address removed)
| > http://www.interlacken.com
| > Author of:
| > *------------------------------------------------------*
| > |\----------------------------------------------------/|
| > || Microsoft Office FrontPage 2003 Inside Out ||
| > || Microsoft FrontPage Version 2002 Inside Out ||
| > || Web Database Development Step by Step .NET Edition ||
| > || Troubleshooting Microsoft FrontPage 2002 ||
| > || Faster Smarter Beginning Programming ||
| > || (All from Microsoft Press) ||
| > |/----------------------------------------------------\|
| > *------------------------------------------------------*
| >
| >
| >
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top