Javascript Create Stylesheet Dynamically
<html> <head> </head> <body> <script> var test = function(){ var _style = document.getElementById("styleDialogLogon"); if(!_style){ _style = document.createElement('style'); _style.setAttribute("id", "styleDialogLogon"); _style.setAttribute("type", "text/css"); _style.appendChild(document.createTextNode("label { display:block;float:left;width:45%;clear:left; }\n")); _style.appendChild(document.createTextNode(".clear { clear:both; }\n")); _style.appendChild(document.createTextNode("#resp { margin:10px;padding:5px;border:1px solid #ccc;background:#fff; }\n")); _style.appendChild(document.createTextNode("#resp li { font-family:monospace }")); document.getElementsByTagName('head')[0].appendChild(_style); } } </script> <button onClick="test();">test</button> </body> </html>
page_revision: 2, last_edited: 1216443685|%e %b %Y, %H:%M %Z (%O ago)





