Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Populating select from array -Help needed



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
gszauer



Joined: 11 Jan 2007
Posts: 3

PostPosted: Thu Jan 11, 2007 10:12 pm    Post subject: Populating select from array -Help needed Reply with quote

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title></title>
  <script language="Javascript" type="text/javascript">
  <!-- Hide from older browsers
  a0 = new Array(
    new Array("title", "url"),
    new Array("title2", "url"),
    new Array("title3", "url")
  )
  function changeMenu (arrayName){
        document.mainDcument.playlist.options.length = 0
        for (i=0; i<=arrayName.length ; i++){
            document.mainDcument.playlist.options[i] = new Option(arrayName[i][0])
         
      }
  }
  // end hiding script -->
    </script>
</head>
<body>
<form name="mainDcument" action="http://">
    <select name="categories" size="5" id="categories" onchange="changeMenu ('a0')">
         <option value="0">populate</option>
        <option value="1">populate</option>
        <option value="2">populate</option>
    </select>
    <select name="playlist" size="5" id="playlist" onChange="changeMenu ()">
         <option value="0">UnPopulated</option>
    </select>
</form>
</body>
</html>

As you can see i am using one list to populate a nother list.
However the code does not work. But if i replace
Code:
 document.mainDcument.playlist.options[i] = new Option(arrayName[i][0])

with
Code:
 document.mainDcument.playlist.options[i] = new Option("EDGE")

It works just fine....
I have no clue why this messes up so bad....
Can anyone please help out?
I really appriciate your time
Thank you,
~Gabor Szauer
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap