JQ写法和js写法 方法函数化

<script>
$(function () {
$('#head').click=function () {
alert($(this).html())
}
})
</script>
<script>
window.onload=function () {
var Ohead=document.getElementById('head');
Ohead.onclick=function () {
alert(Ohead.innerHTML)
}
}
</script>

 

<div id="head">111</div>

  

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>

  

 jquery和js的不同写法 html()  innerHTML

alert( $(this).html() ); //jq的写法

alert( this.innerHTML ); //js的写法

上一篇:JS框架设计读书笔记之-异步


下一篇:数据存储_ SQLite (1)