style对象应用

<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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值