课程
/前端开发
/JavaScript
/Tab选项卡切换效果
这段还是不太理解。。。
2015-01-04
源自:Tab选项卡切换效果 2-1
正在回答
是的,前些天为这个问题困扰了好一会。
axmmrevqnekmyhdbo
我有个类似的代码,发现和你不同的“this.className=''; ”;我的是“titles[j].className="";”
这个 函数的作用就是之后用到id选择器可以简写,至于判断的意义就是传入的参数为字符串就返回
document.getElementById(id),其他的就返回参数本身,这个只是一个获取页面dom元素的一个简陋版本的函数,还不够完善。
orangecat
hnull 回复 orangecat
这样判断有什么意义吗?
举报
本课程详细介绍网页页面中最流行常用的tab切换效果
7 回答function $(id){ return typeof id==='string'?document.getElementById(id):id; }
1 回答function $(id){ return typeof id==="string"?document.getElementById("id"):id}
3 回答function $(id) { return typeof id==='string' ? document.getElementById(id):id;这行代码有什么用???
3 回答请问同学这是什么意思??function $(id){ return typeof id==='string'?document.getElementsById(id):id; }是什么意思
4 回答function $(id){return typeof id==='string'?document.getElementsById(id):id;},为什么不是字符串的时候返回一个id,那有什么用?