[thelist] [javascript] getElementById

Paul Bennett paul at teltest.com
Wed Oct 23 18:14:01 CDT 2002


I am passing 'UserOptions' to a function (as a string) and then using
document.getElementById(function_value_here) to get the element within
the function, so theoretically the output should be:
var ListOption = document.getElementById('UserOptions') // put element
into var
and then I would be able to get the value of 'UserOptions' by going:
ListValue = ListOption.value  // check value property of element - this
is the value of a selected item in a select list

My javascript debug window tells me however, that "ListOption has no
properties", so obviously, the element wasn't able to be "gotten". What
is the correct way to use getElementById? There is no duplicate Id in
the page.....:(

ps - I have been able to use the function successfully by simply passing
the reference as:
document.forms.form_name.UserOptions.value, but thought I would try
something a bit more efficient for this page seeing as it uses the dame
function so many times.

--
Paul Bennett
Internet Developer
Teltest Electronic Design
--------------------------
Phone : 64 4 237 0767
Web : http://www.teltest.com
Wap : http://wap.teltest.com
Email : paul at teltest.com
--------------------------





More information about the thelist mailing list