Jump to content


Photo

variables precendance and descendance


  • Please log in to reply
2 replies to this topic

#1 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 11 June 2006 - 12:44 PM

It is like this:

i have a html file like this:

<html>
<body>
<select id="continent" name="continent">
<option value="Africa">Africa</option>
</select>

</body>
</html>

it's a select named continent.

how do I regard or pass this 'continent' as a variable in a java script?

case 1: somefunction(continent); or
case 2: somefunction(document.continent)

i know in IE, you can pass it like case 1.
but other browser won't take it.

any idea?
Life's too short for arguing.

#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 12 June 2006 - 04:56 PM

use document.getElementById('continent').value to get the select value.

NoGray.com


#3 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 13 June 2006 - 01:46 AM

that's it, thanks
Life's too short for arguing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users