码迷,mamicode.com
首页 > Web开发 > 详细

jquery开发之第一个程序

时间:2015-06-12 11:40:51      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:html   jquery   

前一段时间学习了js和css,但是发现好多的程序里面都用到了jquery当时本来想着先吧js弄熟了 再搞这个,后来发现不行,好多的程序好像是故意和自己为难似的,所以我决定接下来认认真真的把jquery学习一下。
首先现在iquery文件 下载地址:jquery 然后在使用的html页面引入就可以了。
下面来试试第一个jquery程序吧。
test.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>css ajax </title>
<script type ="text/javascript" src ="jquery.js" ></script>

<script type ="text/javascript">
$(document).ready(function(){
    alert("hello world!");
});
</script>
</head>
<body>
jquery test!
<br/>
<div id ="myDivElement">
</div>
</body>
</html>

运行结果如下:

技术分享

可以发现这次用了$(document).ready(function(){
}); 而没有用window.onload() 下面就来说明一下两者之间的区别吧
技术分享

jquery开发之第一个程序

标签:html   jquery   

原文地址:http://blog.csdn.net/hanhailong18/article/details/46469373

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!