[Javascript] help

Walter Torres walter at torres.ws
Wed Apr 16 14:08:41 CDT 2003


This looks like your trying to add an Item to a Pick List (SELECT).

Use this... (see below)

walter

// Add a single Item to a Select Option List
function addOption ( strList, strItemText, strItemValue )
{
   // Which list
   var objList = document.getElementById( strList );

   // Do we have a list to deal with?
   if ( ! objList )
      return false

   // Add New Item Selected item
   objList.options[objList.options.length] = new Option( strItemText,
strItemValue );

   // It worked!
   return true
}




> -----Original Message-----
> From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
> Behalf Of Alex Benitez
> Sent: Monday, February 03, 2003 9:18 AM
> To: javascript at LaTech.edu
> Subject: [Javascript] help
>
>
>
>
> example:  <select id='parentSelect'></select>
>
> then later i call parentSelect.innerHTML = "<option>opval</option>"
>
> what actually ends up in that property is "opval</option>"
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list