<html>
<head>
<title>中国风</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
function changeTable(){ // 改变表格的属性
t1.style.borderLeft="solid red 2px";
t1.style.borderRight="solid blue 2px";
}
function resetTable(){ // 还原表格的属性
t1.style.borderLeft="solid blue 1px";
t1.style.borderRight="solid red 1px";
}
</script>
</head>
<body id="BD" style="background:url(http://www.baidu.com/img/bdlogo.gif) repeat fixed;">
<form>
<input type="button" value="背景图像滚动" οnclick="JavaScript:BD.style.backgroundAttachment='scroll'">
<p>
<input type="button" value="背景图像固定" οnclick="JavaScript:BD.style.backgroundAttachment='fixed'">
<p>
<input type="button" value="清除背景图像" οnclick="JavaScript:BD.style.backgroundImage=''">
<p>
<input type="button" value="添加背景图像" οnclick="JavaScript:BD.style.backgroundImage='url(http://www.baidu.com/img/bdlogo.gif)'">
<p>
<input type="button" value="还原背景初始设置" οnclick="JavaScript:BD.style.background='url(http://www.baidu.com/img/bdlogo.gif)'">
<p>
<input type="button" value="改变表格边框属性" οnclick="changeTable()">
<p>
<input type="button" value="还原表格边框属性" οnclick="resetTable()">
</form>
<table id="t1" style="border-left:solid blue 1px; border-right:solid red 1px; padding:10px; spacing:10px;">
<tr>
<td>中国风</td>
<td>中国风</td>
<td>中国风</td>
<td>中国风</td>
</tr>
</table>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</body>
</html>
style对象应用
最新推荐文章于 2022-07-25 18:36:05 发布