這一節(jié)為什么
window.onload=function(){
//獲取鼠標(biāo)滑過(guò)或點(diǎn)擊的標(biāo)簽和要切換內(nèi)容的元素
var titles=$('notice-tit').getElementsByTagName('li'),
divs=$('notice-con').getElementsByTagName('div');
alert(titles.length);
}
這個(gè)執(zhí)行不出來(lái)呀?
這一節(jié)為什么
window.onload=function(){
//獲取鼠標(biāo)滑過(guò)或點(diǎn)擊的標(biāo)簽和要切換內(nèi)容的元素
var titles=$('notice-tit').getElementsByTagName('li'),
divs=$('notice-con').getElementsByTagName('div');
alert(titles.length);
}
這個(gè)執(zhí)行不出來(lái)呀?
2014-08-29
舉報(bào)
2015-12-15
你把var titles=$('notice-tit').getElementsByTagName('li')改成var titles=$('#notice-tit').getElementsByTagName('li')應(yīng)該就可以了
2015-12-07
最上面得加這句才行
function $(id){
return typeof id==='string'?document.getElementById(id):id;
}
2014-10-07
我也不行,真不懂,試了一天了
2014-08-30
有沒(méi)有加入下面句子?
function $(id){
return typeof id==='string'?document.getElementById(id):id;
}
2014-08-29
$這個(gè)用不了呀,是格式出錯(cuò)了嗎?我改成document.getElementByTagId('notic-tit').getElementsByTagName('li')的格式就可以實(shí)現(xiàn)了