jquery第1期:最初のjqueryを実行
2126 ワード
まずjsファイル、URL jqueryをダウンロードします.comはダウンロードして、1.10版のをダウンロードすることができます
まずeditplusを開いて編集し、jsファイルを追加します.
コードの作成:
まずsrcプロパティでjsファイルを追加します
ドキュメントが完全にロードされると実行される関数
実行結果:
コードを簡単にすることができます
つまりdocument.readyは省略できます.
まずeditplusを開いて編集し、jsファイルを追加します.
コードの作成:
<!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=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.10.1.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
alert("hello jquery");
});
</script>
</head>
<body>
</body>
</html>
<script type="text/javascript" src="js/jquery-1.10.1.js"></script>
まずsrcプロパティでjsファイルを追加します
$(document).ready
ドキュメントが完全にロードされると実行される関数
実行結果:
コードを簡単にすることができます
<!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=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.10.1.js"></script>
<script type="text/javascript">
$(function()
{
alert("hello jquery");
});
</script>
</head>
<body>
</body>
</html>
つまりdocument.readyは省略できます.