????? 最近无意中对jquery产生兴致,感觉到jquery挺好用的,不但学习曲线比较低而且接近javascript语法,今天我们来写一个克隆的东西。呵呵我们从第一步开始。打开Aptana file--->new project --->web project把jquery框架加上。然后new 一个html文件代码如下
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <script type="text/javascript" src="lib/jquery/jquery.js"> </script> <script language=javascript> $(function(){ $("b:eq(0)").click(function(){ $(this).clone(true).appendTo($("p:eq(1)"));//true为深拷贝 }); }); </script> <body> <p> <b>clone</b> </p> <p> <b>here</b> </p> <a>three</a> <a>four</a> </body> </html>
?
1 楼
wavesun
2010-03-30
