jQuery从入门到精通第一篇

时间:2022-01-15 15:19:19
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>
<script type="text/javascript">alert($) </script>


    <style type="text/css">
div{
padding:8px 0px;
font-size:12px;
text-align:center;
border:solid 1px #888;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("div").html("你好,测试成功");
});
</script>
<div></div>

<p id="demo"></p>
<script type="text/javascript">
   var p = document.getElementById("demo");
   p.innerHTML="注意,js代码必须放到元素下边,要不然找不到";
   p.style.color="red";
</script>
__________________________________________


<script type="text/javascript">
window.onload =function()
{
var pp = document.getElementById("demo1");
   pp.innerHTML="注意,onload是指元素加载过后";
   pp.style.color="red";
}


</script>
 <p id="demo1"></p>
__________________________________________


<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    var $p= $('#demojqury');
    $p.html('jqury学习').css("color","black" );
});
    </script>
<p id="demojqury"></p>