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