Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Get value from select


Message #1 by bjarni@v... on Tue, 28 Nov 2000 14:17:08 -0000
This is a multi-part message in MIME format.

------=_NextPart_000_0615_01C05A01.FBE61180
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi,


for <SELECT> use

var selectedvalue =3D 
document.form.selectbox[document.form.selectbox.selectedIndex].value;

jigs
  ----- Original Message -----
  From: Eggert Bjarni Saevarsson
  To: javascript
  Sent: Tuesday, November 28, 2000 7:47 PM
  Subject: [javascript] Get value from select


  I am trying to get a value from a form into a javascript function that 
puts it in a string and sends it to an asp page.

  Its not a problem reading from textfields but Im having problem 
reading from select in navigator, works fine in explorer.

  <script language=3D"javascript">
  function Breyta() {
  var Texti =3D document.Form.Select.value;
  var Texti2 =3D document.Form.Text.value;
  alert("Select =3D "+ Texti + "\nText =3D " + Texti2);
  }
  </script>
  <a href=3D"javascript:Breyta()">asdasdf</a>
  <form name=3D"Form">
  <select Name=3D"Select">
  <option value=3D"1">1111</option>
  <option value=3D"2">2222</option>
  </select>
  <input type=3D"text" name=3D"Text">
  </form>
  
  Any ideas?
  

  Best regards
      Bjarni S=E6varsson
      bjarni@v...
  ---
  NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
  Visit EarthWeb for the latest in IT Management, Software Development,
  Web Development, Networking & Communications, and Hardware & Systems.
  Click on http://www.earthweb.com for FREE articles, tutorials,
  and discussions from the experts.
$subst('Email.Unsub')




  Return to Index