Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    myslt has no properties

    Here is the generated code:

    Code:
    <html>
    <head>
    </head>
      <body>
       <body"></body">
    
    	<h2>Music Albums</h2>
       <script src="data.js"></script>
          <div style="position: relative; top: 20px; left: 3%;">
          <div style="color: green;">Musician</div>
            <select id="mymusic" multiple="multiple" size="10" onclick="opt_click()">
              <option name="opt1">Diana Krall</option>
              <option name="opt1">Shania Twain</option>
              <option name="opt1">The Beatles</option>
              <option name="opt1">BeeGees</option>
           </select><br>
    
          <div style="color: red;">Genre</div>
            <select id="mygenre" multiple="multiple" size = "10" onclick="check_click()">
    	    <option name="opt2">jazz</option>
    	    <option name="opt2">country</option>
    	    <option name="opt2">rock</option>
           </select>
        </div>
    	<div style="position: absolute; top: 20px; left: 20%;">
    	 <div id="div1">
    	 </div>
           </div>
    
        <script src="events.js"></script>
      </body>
    </html>
    And here is my function

    Code:
    function opt_click()
    {
    var mychk = document.getElementById("mygenre");
    var mydiv = document.getElementById("div1");
    var myslt = document.getElementById("myartist");
    var outsl = "";
    var the_out = new Array();
    
    for(i=0;i<myslt.options.length;i++)
    	{
    		if(myslt.options[i].selected)
    			{
    				for(var k=1;k<album.length;k+=album_size)
      				      {
     					   var m = myslt.options[i];
        					   var found=false;
      					 for(var j=0;j<the_out.length;j++)
         						 {
    							if(m == the_out[j])
          					        {
    	  				             found = true;
    	  				             break;
    					              }
       		                        }
      		            if(!found)
       		               	{
    		                  the_out.push(m);
       			            }
                                 }
                 	}
           }
      for(p=0;p<the_out.length;p++)
    	{
    	outsl = outsl + p;
    	}
        mydiv.innerHTML = outsl;
    }
    Here's what I have to do. Take the select box, named 'myartist'. Scan that select box, to see what the user has selected. Assume that in the array 'album', there are the names of the artists on every 5th interval (1, 6, 11). I want to take whatever the user selected, input it into an array; at the point I'm at, all I want to get back are the names, but I need to get back other things besides just the name (pictures, song titles, genre).

    If you can't see what i'm doin, jus ask.
    The way I see it is this: you have this id of 'myartist', and in the function, it is changed to 'myslt'. But mozilla tells me myslt has no properties. How is this happening?

  • #2
    New Coder
    Join Date
    Oct 2006
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nevermind...i'm retarded...I changed the id of my select box and didn't change it of my get element function...-_-


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •