Updating text box from onChange of List Menu
what am I doing wrong here:
function _updateInfo()
{
var movieName=document.listMenu.movielist.selectedIndex;
var movieRating = new Array
("R","PG","G");
var movieRoom = new Array
("PR2","PR1","PR5");
document.text.rating.value=movieRating[movieName]; document.textbox.room.value=document.listMenu.movieRoom[movieName].value;
}
[400 byte] By [
CB77] at [2007-11-11 9:53:18]

# 1 Re: Updating text box from onChange of List Menu
What doctype does your page use? What is "listMenu"? The DOM-compliant method of accessing document elements is to use the "document.getElementById()" method. I suspect your browser doesn't know how to interpret ambiguous statements such as "document.listMenu.movielist" or "document.text.rating".
I'm new to this site; doesn't this site have a policy about posting code? It's easier to read if you use the appropriate BBCODE tags.
tgreer at 2007-11-11 23:34:36 >

# 2 Re: Updating text box from onChange of List Menu
thanks actually had a closer look at my code and had some spelling mistakes in my frame code...little stuff that is difficult for me to see unless I print out the code.
I think the preference here is to provide as much code as possible although not provide too much detail...makes it easier for others to understand the problem better. I normally take out the really detailed stuff and post more generic but was kind of tired at the time and frustrated with what I was doing.
CB77 at 2007-11-11 23:35:36 >

# 3 Re: Updating text box from onChange of List Menu
No problem. I meant using the forum software's code tags, as so:
function _updateInfo()
{
var movieName=document.listMenu.movielist.selectedIndex;
var movieRating = new Array
("R","PG","G");
var movieRoom = new Array
("PR2","PR1","PR5");
document.text.rating.value=movieRating[movieName]; document.textbox.room.value=document.listMenu.movieRoom[movieName].value;
}
tgreer at 2007-11-11 23:36:40 >
