`

jquey demo

阅读更多
<html>
<head>
  <title> this is the query  demo</title>
  <script type="text/javascript" src="jquery-1.6.4.min.js"></script>
  <script type="text/javascript">
     $(document).ready(function(){
    alert("this is the test");
//$("#tid").html("this is hello world by Jquery");
$("div b").html("this is the b element");
});
   </script>
</head>

<body>
   hello  everyone! <br>
   this is  hello world by html.
   <div id="tid">
<b> hhh</b>
   </div>
   this is the good!
</body>
</html>

1.
    $("#msg").html();
    $("#msg").html("hello");

上面两行代码,调用了同样的函数。但结果却差别很大。
第一行是返回指定元素的HTML值,第二行则是将hello这串字符设置到指定元素中。jquery的函数大部分有这样的特性
2.ajax
$.get("search.do",{id:1},rend);  
function rend(xml){  
    alert(xml);  
}
3.渐入渐出
$("#msg").fadeIn("fast");  
$("#msg").fadeOut("slow"); 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics