`
axl234
  • 浏览: 274624 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

jQuery 1.4新功能

阅读更多

 1.创建DOM

 

$(function(){
$("<div/>",{
   id: "justTest",
   className: "red",
   css: {
    width: "200px",
    height: "40px",
    backgroundColor: "#f0f3f9"
   },
   click: function(){
    alert("别点我,真是疼!");
   },
   text: "别点我!"
}).appendTo("body");
});

 

 

2.绑定多事件

 

<script type="text/javascript">
$(function(){
$("#foo").bind({
   click: function(){
    $("#show").text("你居然点人家!");
   },
   mouseover: function(){
    $("#show").text("哎呦,你摸人家~~");
   },
   mouseout: function(){
    $("#show").text("死鬼,你别走啊!");
   }
});
});
</script>

<body>
<div id="foo" style="width:400px; padding:15px; font-size:14px; background:#f0f3f9;">点我,摸我……</div>
<p id="show" style="font-size:12px;"></p>
</body

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics