dom和css

 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
<title>CSS Inline Rule Scripting</title>
 
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
 
</head>
 
<body>
 
 
 
<div id="test"> CSS Rules in Action </div>
 
<hr />
 
 
 
<script type="text/javascript"> 
 
<!-- 
 
  theElement = document.getElementById("test");
 
//-->
 
</script>
 
 
 
<form id="cssForm" name="cssForm" action="#" method="get">
 
<strong>Alignment:</strong>
 
<select
 
 οnchange="theElement.style.textAlign=this.options[this.selectedIndex].text;">
 
      <option>left</option>
 
      <option>center</option>
 
      <option>right</option>
 
      <option>justify</option>
 
</select>
 
<br /><br />
 
 
 
<strong>Font:</strong> 
 
<select
 
 οnchange="theElement.style.fontFamily=this.options[this.selectedIndex].text;">
 
      <option>sans-serif</option>
 
      <option selected="selected">serif</option>
 
      <option>cursive</option>
 
      <option>fantasy</option>
 
      <option>monospace</option>    
 
</select>
 
 
 
  
 
 
 
<input type="text" id="font" name="font" size="10" value="Impact" />
 
<input type="button" value="set" οnclick="theElement.style.fontFamily =
 
 document.cssForm.font.value;" />
 
 
 
<br /><br />
 
<strong>Style:</strong> 
 
<select
 
οnchange="theElement.style.fontStyle=this.options[this.selectedIndex].text;">
 
      <option>normal</option>
 
      <option>italic</option>
 
      <option>oblique</option>    
 
</select>
 
 
 
<strong>Weight:</strong> 
 
<select οnchange="theElement.style.fontWeight=this.options[this.selectedIndex].text;">
 
      <option>normal</option>
 
      <option>bolder</option>
 
      <option>lighter</option>
 
</select>
 
 
 
<strong>Variant:</strong> 
 
<select
 
 οnchange="theElement.style.fontVariant=this.options[this.selectedIndex].text;">
 
      <option>normal</option>
 
      <option>small-caps</option>
 
</select>
 
<br /><br />
 
 
 
<strong>Text Decoration</strong>
 
<select
 
οnchange="theElement.style.textDecoration=this.options[this.selectedIndex].text;">
 
      <option>none</option>
 
      <option>overline</option>
 
      <option>underline</option>
 
      <option>line-through</option>
 
      <option>blink</option>
 
</select>
 
 
 
<br /><br />
 
<strong>Font Size:</strong>
 
<select
 
 οnchange="theElement.style.fontSize=this.options[this.selectedIndex].text;">
 
      <option>xx-small</option>
 
      <option>x-small</option>
 
      <option selected="selected">small</option>
 
      <option>medium</option>
 
      <option>large</option>
 
      <option>x-large</option>
 
      <option>xx-large</option>
 
</select>
 
  
 
 
 
<input type="text" id="size" name="size" size="3" maxlength="3" value="36pt" />   
 
<input type="button" value="set" οnclick="theElement.style.fontSize =
 
 document.cssForm.size.value;" />
 
<br /><br />
 
 
 
<strong>Color:</strong> 
 
<input type="text" id="fgColor" name="fgColor" size="8" value="yellow" />
 
<input type="button" value="set" οnclick="theElement.style.color =
 
 document.cssForm.fgColor.value;" />
 
 
 
<br /><br />
 
<strong>Background Color:</strong> 
 
<input type="text" id="bgColor" name="bgColor" size="8" value="red" />
 
<input type="button" value="set" οnclick="theElement.style.backgroundColor =
 
 document.cssForm.bgColor.value;" />
 
 
 
<br /><br />
 
<strong>Borders:</strong> 
 
<select
 
 οnchange="theElement.style.borderStyle=this.options[this.selectedIndex].text;">
 
      <option>none</option>
 
      <option>dotted</option>
 
      <option>dashed</option>
 
      <option>solid</option>
 
      <option>double</option>
 
      <option>groove</option>
 
      <option>ridge</option>
 
      <option>inset</option>
 
      <option>outset</option>
 
</select>
 
<br /><br />
 
 
 
<strong>Height:</strong>
 
<input type="text" id="height" name="height" value="100px" size="3" />   
 
 
 
<strong>Width:</strong> 
 
<input type="text" id="width" name="width" value="100px" size="3" />   
 
<input type="button" value="set" οnclick="theElement.style.height =
 
 document.cssForm.height.value; theElement.style.width =
 
 document.cssForm.width.value;" />
 
 
 
<br /><br />
 
<strong>Top:</strong> 
 
<input type="text" id="top" name="top" value="100px" size="3" />   
 
<strong>Left:</strong>
 
<input type="text" id="left" name="left" value="100px" size="3" />   
 
<input type="button" value="Set"
 
 οnclick="theElement.style.position='absolute';theElement.style.top =
 
 document.cssForm.top.value; theElement.style.left = document.cssForm.left.value;"
 
 />
 
<br /><br />
 
<strong>Visibility</strong>   
 
<input type="button" value="show" οnclick="theElement.style.visibility='visible';"
 
 />
 
<input type="button" value="hide" οnclick="theElement.style.visibility='hidden';"
 
 />
 
</form>
 
<hr />
 
</body>
 
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值