首页 >web前端 >js教程 >学习jquery之一_jquery

学习jquery之一_jquery

WBOY
WBOY原创
2016-05-16 19:14:181067浏览

 

1学习jquery


val()可以取值;val(s)可以赋值





 





<script> <BR><!-- <BR>$(document).ready(function(){ <BR>$("#get").click(function(){ <BR>$("#test").html("我是input的值:"+$("#mm").val()) <BR>}) <BR>$("#put").click(function(){ <BR>$("#mm").val("val()真好用") <BR>}) <br><br>$("#an").click(function(){ <BR>var a=$("#an").val()=="展开"?"缩进":"展开" <BR>//$("#an").val(a) <BR>if(a=="展开"){ <BR> $("#test").slideUp("slow",function(){$("#an").val(a)}); <BR>//$("#test").fadeOut("fast",1000); <BR>// $("#test").fadeIn("fast",500) <BR>} <BR>else{ <BR>$("#test").slideDown("slow",function(){$("#an").val(a)}); <br><br>//$("#test").fadeOut("fast",1000); <BR>//$("#test").fadeOut("slow",500) <BR>} <BR>}) <BR>$("span").css({background:'black',color:"red"}) <BR>//is叛断 <BR>$("button[@id='get']").parent().is("div") <BR>$("#test").html("css();animate()") <BR>$("div#test").css({ left: 10,height:200,width:200,background:"black",color:"white"}); <BR>$("div#test").animate({ left: 500, opacity: 'show' }, 500); <br><br><BR>}); <br><br><br><br>function aiqi(){ <BR>$("#mm").val("asdasd") <BR>$("p").css("color","red") <BR>$("div#test").background("gray") <BR>$("div#test").css("color","yellow"); <BR>$("div#test").css({width:"200",height:200}) <BR>$("div#test").html($.browser.msie) <BR>//$("#mm").click(function{alert()}); <BR>$("#test").fadeOut("fast",1000); <BR>$("p").fadeTo("slow", 0.5); <BR>$("#test").fadeIn("slow",0.5,function(){ alert("Animation Done."); }); <BR>$.each( [0,1,2], function(i){ alert( "Item #" + i + ": " + this ); }); <BR>$("p").slideDown("slow",function(){ alert("Animation Done."); }); <BR>} <br><br>//aiqi(); <BR>//$("p").mousedown();//$("img").oneload( function() { alert("Hello"); } ); <br><br>//$.getScript("test.js",function(){ <BR>//alert(obj.name)}) <BR>//$.getJSON("test.js", function(obj){ alert(obj.name);}) <BR>//--> <BR></script>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn