javascript 使用方式

时间:2014-05-26 05:01:39   收藏:0   阅读:250

第一种:内嵌在html节点中

<html>
<body>

<input type="button" onclick="document.body.style.backgroundColor='lavender';"
value="Change background color" />

</body>
</html>


第二种:调用方法

<html>
<body>

<script>
function ChangeBackground()
{
document.body.style.backgroundColor="lavender";
}
</script>

<input type="button" onclick="ChangeBackground()"
value="Change background color" />

</body>
</html>

第三种:导入js文件

 <script src=“url” type="text/javascript"></script>


javascript 使用方式,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!