When writing Div attributes, it is often necessary to try different styles, and you can write a simple div-style viewer in JavaScript for daily operation:
1 <!DOCTYPE HTML>2 <HTML>3 <HeadLang= "en">4 <MetaCharSet= "UTF-8">5 <title>div Style Viewer</title>6 <style>7 #div1{8 Height:200px;9 width:200px;Ten background:Gray; One } A </style> - <Script> - functionChange () { the varstyle=document.getElementById ("style"). Value; - varparam=document.getElementById ("param"). Value; - varvalue=document.getElementById ("value"). Value; - Alter (STYLE,PARAM,VALUE); + } - functionAlter (style,param,value) { + varDiv1=document.getElementById ("Div1"); A if(Style!="") at { - Div1[style][param]=value; - } - Else - { - Div1[param]=value; in } - } to </Script> + </Head> - <Body> theStyle<inputtype= "text"ID= "Style"><BR> *Param<inputtype= "text"ID= "param"><BR> $Value<inputtype= "text"ID= "value"><BR>Panax Notoginseng <inputtype= "button"value= "Change"onclick= "Change ()"/> - <DivID= "Div1"></Div> the </Body> + </HTML>
div Style Viewer