[Javascript] how can I add the <option selected to this ???

Scott.Wiseman swiseman at remax-cahi.com
Mon Jul 8 20:17:05 CDT 2002


function ActiveList()
{

if (document.myform.salesagents.length > 0)
   {
     document.myform.salesagents.options = null;	  
      document.myform.salesagents.options.selectedIndex = 0; 
   }   
 
   for(var x=1; x< LoadAgents1.length; x++)
      {
      
       if (x=1)
         {
           document.myform.salesagents.options[x]        =  new Option(x);

********** here

          document.myform.salesagents.options[x].value  =  <option
selected>Select Agent</option>  &nbsp;
 
           document.myform.salesagents.options[x].text   =   LoadAgents1[x];

         }
       else
         {
           document.myform.salesagents.options[x]        =  new Option(x);

           document.myform.salesagents.options[x].value  =   LoadAgents0[x];

           document.myform.salesagents.options[x].text   =   LoadAgents1[x];

         }           
     }  

}



More information about the Javascript mailing list