<html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题页</title> <script src="jquery-1.10.2.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ //dom对象想要通过jq进行操作,先要转换为Jq对象 //document.getElementById("div1").innerHTML(); alert($('#div1').html()); var div1 = document.getElementById("div1"); //$(div1) 将dom对象转换成jq对象 //$(div1).html('222222222222'); //将jq对象转换成dom对象 //var div2 = $(div1)[0]; //或者get() //alert(div2.innerHTML); $('#div1').css('background','red'); alert($('#div1').css('background')); $('#txt1').val(new Date()); alert($('#txt1').val()); $('#div1').html('a<font color=\'#FFFFFF\'>WW</font>bc') alert($('#div1').html()); }); </script> </head> <body> <div id="div1">11111111111 <input type="text" id="txt1"/> </div> </body> </html>
Jquery系列-Jquery对象
最新推荐文章于 2022-09-02 21:02:24 发布