[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SELECT values

At 03:10 PM 3/20/96 -0800, Chris Moses wrote:
>All I want to do is return the value selected in the OPTION list in the
alert window.

At the bottom of this message, I put in a simple script I've written that
will be my next 'GUIDE' tutorial on the 411 for select objects.  Figured I'd
post it now rather than say 'check the site in a few days'. Hope it helps.

>        function newtopic() {
>                alert("Selected SubTopicID="+document.SubTopicID.value)

What you need to do is reference the 'text' property or the 'options' array
like I did in my example:


>By the way, I spent a good amount of time on 411. It is a very nice FAQ,
good work 
>Andy. I have a couple suggestions but I'll post them seperately.

Send em in, I really like to hear new suggestions.
So anyway, here's my code:

<HTML><HEAD><TITLE>Guide to Select Object</TITLE>

<SCRIPT LANGUAGE="Javascript">

function showSelected(form) {
 form.display.value = form.make.options[form.make.selectedIndex].text

// -->

<FORM NAME="test">
 <SELECT NAME="make">
 <INPUT TYPE="button" VALUE="Show selected option"
 <INPUT NAME="display">

-Andy Augustine
JavaScript 411 -- http://www.freqgrafx.com/411/

For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/