prototype.js
window.onload = function() {
$$('a.box').invoke('observe', 'click', function(){
alert('Hello world!');
});
}
jquery.js
$(document).ready(function(){
$("a.box").click(function(){
alert('Hello world!');
});
});
<a href="#" class="box" >link</a>
Showing posts with label jquery.js. Show all posts
Showing posts with label jquery.js. Show all posts
Wednesday, February 04, 2009
Friday, December 14, 2007
jquery.js でHTMLファイルのインクルード
PHPなどで使用しているHTMLファイルのインクルードをjquery.js
を使って行う例
これでfooterやheaderなど同じような箇所をコピペしなくてもよくなり、
メンテナンスが楽になります。
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript"><!--
$(function(){
$("#header_js").load("header.html");
});
// --></script>
</head>
<body>
<div id="header_js"></div>
を使って行う例
これでfooterやheaderなど同じような箇所をコピペしなくてもよくなり、
メンテナンスが楽になります。
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript"><!--
$(function(){
$("#header_js").load("header.html");
});
// --></script>
</head>
<body>
<div id="header_js"></div>
Subscribe to:
Comments (Atom)