☀【DOM对象 / jQuery对象】

jQuery对象和DOM对象 √
http://www.ituring.com.cn/article/38868

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<ul>
<li>item</li>
<li>item</li>
</ul>
<script src="http://static01.baomihua.com/js/lib/jquery-1.4.4.min.js?t=20120926.js"></script>
<script>
var aElem = $('a')
var liElem = $('li') console.log(aElem)
console.log(aElem.length)
console.log(aElem[0])
console.log(liElem)
console.log(liElem.length)
console.log(liElem[0], liElem[1]) aElem.click(function() {
})
if (aElem[0]) {
} var aElem = document.getElementsByTagName('a')[0]
var liElem = document.getElementsByTagName('li')[0] console.log(aElem)
console.log(liElem) if (aElem) {
aElem.onclick = function() {
}
}
liElem.onclick = function() {
} function getElem(elem) {
return document.getElementsByTagName(elem)[0] || document.createElement(elem) // 这样处理不报错了,jQuery怎么处理?
}
getElem('a').onclick = function() {
}
</script>
</body>
</html>
上一篇:CSS3(5)---伸缩布局(Flex)


下一篇:Atitit 边缘检测原理attilax总结