NS 4.07 - how to get select box value?

Results 1 to 3 of 3

Thread: NS 4.07 - how to get select box value?

  1. #1
    Join Date
    Dec 1969

    Default NS 4.07 - how to get select box value?

    for example:<BR><BR>I have a form called "form1" and a select box called "sel1" <BR><BR>How do I reference it&#039;s selected value in Netscape 4.07??

  2. #2
    Join Date
    Dec 1969

    Default RE: NS 4.07 - how to get select box value?

    4.07? God only knows.<BR><BR>&#060;script&#062;<BR>function getDropDownValue(sForm, sSel){<BR> var oForm = document.forms[sForm];<BR> if(!oForm){ return false; }<BR> var oSel = oForm.elements[sSel]<BR> if(!oSel){ return false; }<BR> if(!oSel.options){ return false; }<BR> if(oSel.selctedIndex == -1){ return false; }<BR> return oSel.options[oSel.selectedIndex].value;<BR>}<BR>&#060;/script&#062;<BR><BR>Or something. But, seriously, 4.07? That&#039;s technology from about 10 years ago. My 10-yera-old car only just starts in the morning, and the same principle appliest to browsers from that era and the web today. Have you read this:<BR>http://www.alistapart.com/articles/tohell/<BR><BR>Craig.

  3. #3
    Join Date
    Dec 1969

    Default Easy...and you can use it...

    ...for *ALL* browsers:<BR><BR>var sel1Value = document.form1.sel1.options[document.form1.sel1.selectedIndex].value;<BR><BR>Or, if you will be using the form and/or select in several places in your JS code:<BR><BR>var frm = document.form1;<BR>var sel = frm.sel1;<BR>var sel1Value = sel.options[sel.selectedIndex].value;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts