日期:2014-05-17 浏览次数:20899 次
<script type="text/javascript" src="jquery-1.3.1.js">
$(document).ready(function(){
$("#di").html("helloworld"); //id 选择器
$(document.getElementById("di")).html("nihao");//dom 对象转换成jquery 对象
$("#di").get(0).innerHTML="caoshenghuan"; //jquery 对象转换成dom 对象
,这里是不是写错了?应该是$("div").get(0)吧?
$("#di").text("曹胜欢");
alert($("#di").text());//同一函数的set、get 方法
});
</script>
</head>
<body>
<div id="di" style="background-color:#002 ; width:50px; height:100px;" ></div>
<div id="di1" style="background-color:#002 ; width:50px; height:100px;"></div>
<div id="di2" style="background-color:#002 ; width:50px; height:100px;"></div>
</body>
</html>