最新回答 / 慕粉201702
<!doctype html><html><head>? ? <meta charset="UTF-8"><title>Document</title><style type="text/css">? ? *{margin:0;? ? ?padding:0;? ? ?font-size:13px;? ? ?list-style:none;}.menu{width:210px;? ? ? margin:50px auto;?...
2017-05-19
最新回答 / 洛洛
因為這個id作為形參的是時候本來就是string屬性所以不用帶,但是寫notice-tit這種的時候是一個字符串所以需要帶,至于你為什么alert不出來,我自己試了一下是可以的,可能你html里的類名沒寫對
2017-05-15
最新回答 / 慕粉1554206971
wrap.onmouseout=auto; ? 這里是當(dāng)鼠標(biāo)移出容器時恢復(fù)自動播放,wrap.onmouseout=function() {timer=setInterval(autoPlay,1000);}這是我的寫法,至于這里為什么用auto就不清楚了
2017-05-11
最新回答 / 食夢者3711585
window.onload=function(){ ? ? ? ? // 將所有點擊的標(biāo)題和要顯示隱藏的列表取出來? ? ? ? var titls=document.getElementById("menu").getElementsByTagName("p");? ? ? ? var uls=document.getElementById("menu").getElementsByTagName("ul");? ? ? ? // 遍歷所有要點擊的標(biāo)題且給它們添加索引及綁定事件 ? ?if(titls...
2017-05-10
最新回答 / 慕斯8234454
老師講解是用 "titles.length" 做循環(huán) (for(var i=0;i<titles.length;i++)),因此this 代表 titles
2017-05-05
最新回答 / you_belong_to_me
function $(id){? return typeof id==='string'?document.getElementsById(id):id;? }$ ?函數(shù)名。id 參數(shù)如果傳入的id是字符串類型的。返回 document.getElementById(id)
2017-04-25
最新回答 / 慕斯8234454
定義標(biāo)簽id 不能用數(shù)字開頭,但js 理獲取循環(huán)的標(biāo)簽id 只是代表數(shù)組(標(biāo)簽有很多個,所以才要循環(huán))中的第幾個,并不是HTML 中代表標(biāo)簽的id
2017-04-12
最新回答 / startitunderground
<...code...>function getId(id){ return ?typeof id==="string"?document.getElementById(id):id; };window.addEventListener("load",function(){ //獲取鼠標(biāo)滑過或點擊的標(biāo)簽和要切換的內(nèi)容的元素 var navList=getId("nav").getElementsByTa...
2017-04-04
最贊回答 / 慕虎9030788
//封裝ID //typeof?操作符來檢測變量的數(shù)據(jù)類型???string=字符串 //函數(shù)作用:之后用到id選擇器可以簡寫,判斷傳入的參數(shù)為字符串就返回 //$就是一個標(biāo)示符。?也可以用getID等,如果你的頁面中...
2017-03-24