畅学网
使用Javascript控制样式
2014-12-6 Andre tian

<!DOCTYPE html>
<html>
<body>

<p id="p1">Hello World!</p>
<p id="p2">Hello World!</p>

<script>
document.getElementById("p2").style.color="red";
document.getElementById("p2").style.fontFamily="Arial";
document.getElementById("p2").style.fontSize="larger";
</script>

<p>上面的段落已被一段脚本修改。</p>

</body>
</html>


 

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容