最新回答 / 慕粉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; 这里是当鼠标移出容器时恢复自动播放,wrap.onmouseout=function() {timer=setInterval(autoPlay,1000);}这是我的写法,至于这里为什么用auto就不清楚了
2017-05-11
最新回答 / 食梦者3711585
window.onload=function(){ // 将所有点击的标题和要显示隐藏的列表取出来 var titls=document.getElementById("menu").getElementsByTagName("p"); var uls=document.getElementById("menu").getElementsByTagName("ul"); // 遍历所有要点击的标题且给它们添加索引及绑定事件 if(titls...
2017-05-10
最新回答 / 慕斯8234454
老师讲解是用 "titles.length" 做循环 (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; }$ 函数名。id 参数如果传入的id是字符串类型的。返回 document.getElementById(id)
2017-04-25
最新回答 / 慕斯8234454
定义标签id 不能用数字开头,但js 理获取循环的标签id 只是代表数组(标签有很多个,所以才要循环)中的第几个,并不是HTML 中代表标签的id
2017-04-12
最新回答 / startitunderground
<...code...>function getId(id){ return typeof id==="string"?document.getElementById(id):id; };window.addEventListener("load",function(){ //获取鼠标滑过或点击的标签和要切换的内容的元素 var navList=getId("nav").getElementsByTa...
2017-04-04
最赞回答 / 慕虎9030788
//封装ID //typeof 操作符来检测变量的数据类型 string=字符串 //函数作用:之后用到id选择器可以简写,判断传入的参数为字符串就返回 //$就是一个标示符。 也可以用getID等,如果你的页面中...
2017-03-24