Repost of [Javascript] Adding an item to a select list fromanother window

David Lovering dlovering at gazos.com
Fri Sep 26 16:46:19 CDT 2003


<snip>

I find sometimes that IE (and Netscape, and Mozilla, and Opera, etc. 
etc.) often plays fast-and-loose with the objects and the style 
parameters they SAY they support.  If you REALLY want to find out all 
the gruesome style parameters for an option, try putting a tracer 
routine in your code, thusly:

      function getProps(obj, objName) {
        var result = "";
        var win = 
window.open("","","height=400,width=350,left=20,top=50,resizeable=yes,titlebar=no,menubar,scrollbars");
        win.document.open("text/html");
        win.document.write("<script> document.bgColor = 'white'; 
</script>\n");
        win.document.write("<script> document.title = '" + objName + " 
Properties'; </script>\n");
        win.document.write("<center><b>" + objName + " 
Properties</b><p></center>\n");
        for (var i in obj) {
          result = objName + "." + i + " = " + obj[i] + "<BR>";
          win.document.write(result);
          result = "";
        }
        win.document.close();
      } // getProps
                                                                                                                                                                                  
      function doStuff(theObject) {
        if (!theObject) { return -1; }
        if (theObject == "") { return -1; }
        var theIndex = theObject.selectedIndex;
        var theOption = theObject.options[theIndex];
        getProps(theOption.style, 'theOption.style');
      } // doStuff

      .... yada, yada

       <select id='mySelect' name='mySelect' onchange='doStuff(this)'>
         <option style='color: blue; background-color: red'>Skank</option>
         <option style='color: yellow; background-color: 
green'>Wonker</option>
         <option style='color: blue; background-color: white'>Fubar</option>
       </select>

      .... yada, yada

  I've dug more proprietary secrets out of IE with this than I ever 
found in their "Developer's Guide".

  -- Dave Lovering

>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>  
>





More information about the Javascript mailing list