Develop JavaScript across your browser

xiaoxiao2021-04-09  332

Develop JavaScript across your browser

Determining the browser type: if (Document.uniqueID) If true is IE, not IE. 1 Putting Row 2 2 Pattern 3 Setting Element 3 Setting Elements by JavaScript Setting Elements 4 Creating Input Elements 5 Add Event Handle 6 Creating a radio button

1.

var cell = documentcreateElement (" TD "). Appendchild (document.createtextNode (" foo "); var row = . document.createElement ( "tr") appendChild (cell); document.getElementById ( "MyTableBoyd") appendChild (row);. 2. var spanElement = document.getElementById ( "myspan"); //spanElement.setAttribute("style "," Font-Weight: bold; color: red "); spanelement.style.csstext =" font-weight: bold; color: red "; 3. Element.setttribute (" class "," stylename "); // Non-IE Element.setttribute ("classname", "stylename"); // IE 4. Var button = document.createElement ("input"); button.SetaTRibute ("type", "button"); document.getlementByid (" "). Appendchild (Button); 5. var element = document.getlementByid (" ee "); element.οnclick = function () {TODO ();}; 6. var rate = document.createElement (" ); // IE Vat Radion = Document.createElement ("INPUT"); Radion .SetaTRibute ("Type", "Radio"); Radion.setttribute (" Name "," Radion SSS "); radion.setttribute (" Value "," Checked ");

转载请注明原文地址:https://www.9cbs.com/read-133181.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.045, SQL: 9