刚找到一个不错的东东
body { margin: 36pt 24pt 36pt; }
body { margin: 11.5%; }
body { margin: 10% 10% 10% 10%; }
<style> #idParentDiv{width:100%;padding:6px;background-color:buttonshadow;} #idDiv{width:400px;height:80px;background-color:#FFD700;padding:6px;} #idCodeDiv{width:100%;padding:4px;font-family:verdana,tahoma;margin:12px 0px 0px 0px;background-color:#EEEEEE;font-weight:bold;} </style> <script> var iValue=0; function rdl_doAdd(e){ var oCodeDiv=document.all(“idCodeDiv”); var oDiv=document.all(“idDiv”); var oNum=document.all(“idNum”); iValue+=1; oNum.value=oDiv.style.marginLeft=iValue.toString()+”px”; oCodeDiv.innerText=”margin-left : “+oNum.value+” ; “; } function rdl_doDvv(e){ var oCodeDiv=document.all(“idCodeDiv”); var oDiv=document.all(“idDiv”); var oNum=document.all(“idNum”); iValue-=1; oNum.value=oDiv.style.marginLeft=iValue.toString()+”px”; oCodeDiv.innerText=”margin-left : “+oNum.value+” ; “; } </script> <div id=idParentDiv> <div id=idDiv><img src=”http://bbs.51js.com/images/standard/51js.gif” style=”float:left;border:1px solid #000000;”>请从下方选属性的值。</div> </div> <table><tr><td> <input id=idNum type=text value=”0px” size=19 readonly> </td><td> <input type=button onclick=”rdl_doAdd();” value=” + ” id=idBtn1> </td><td> <input type=button onclick=”rdl_doDvv();” value=” – ” id=idBtn2> </td></tr></table> <div id=idCodeDiv>margin-left : 0px ; </div>
[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]