js的属性操作

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">


		<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
		Remove this if you use the .htaccess -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">


		<title>js的属性操作</title>
		<meta name="description" content="">
		<meta name="author" content="Administrator">


		<meta name="viewport" content="width=device-width; initial-scale=1.0">


		<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
		<link rel="shortcut icon" href="/favicon.ico">
		<link rel="apple-touch-icon" href="/apple-touch-icon.png">
		<script type="text/javascript" charset="utf-8">
			window.onload = function(){
				var bu1 = document.getElementById("bu1");
				var bu2 = document.getElementById("bu2");
				var  p =document.getElementById("p1");
				
				var num =16;
				bu1.onclick = function(){
					num++;
					if (num>=20) {
						num=20;
					}
					p.style.fontSize = num +"px"
				}
				
				bu2.onclick = function(){
					num--;
					if (num<=10) {
						num=10;	
					}
					p.style.fontSize = num+"px";
//p.className<span style="white-space:pre">		</span>
				}
			}
		</script>
		
	</head>


	<body>
		<input type="button" id="bu1" value="+">
		<input type="button" id="bu2"value="-">
		<p id="p1">也就是两三年前,在我大约二十六七岁的年纪,是最为恨嫁的时候。不知为何,这个社会对于女人隐约有这么一条年龄的分界线,25岁算是顶峰,26 27嫁人算是正当好,此后便一泻千里,各种比喻都用来形容女子在婚恋市场上的滞销。 也正是在那样的年纪,尚未彻底认清自己对于爱情,婚姻的看法,又值空窗期,父母催促,各种焦虑,于是觉得终身大事万万不可懈怠,赶紧要相亲..</p>
	</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值