日期:2014-05-17  浏览次数:21090 次

这两个FUNCTION 有什么区别,一个是我写的,一个是别人写的,为什么我的不能用?
<script>
function   wlll(sid){
whichEl   =   eval( "ll "   +   sid);
if   (whichEl.style.display   ==   "none "){
eval( "ll "   +   sid   +   ".style.display=\ "\ "; ");
}else{
eval( "ll "   +   sid   +   ".style.display=\ "none\ "; ");
}
}
//下面是我写的,呵呵,初学,别笑我!!
function   wlll(){
if   (ll1.style.display   ==   "none "){
ll1.style.display   ==   " ";
}else{
ll1.style.dispaly   ==   "none ";
}
}
</script>


------解决方案--------------------
<script type= "text/javascript ">
function wlll(sid) {
whichEl = eval( "w " + sid);
whichEl.style.display = (whichEl.style.display == "none " ? " " : "none ");
}
</script>
<input id= "wc " type= "button " value= "无辜的按钮 " />
<input type= "button " value= "隐藏/显示 " onClick= "javascript:wlll( 'c '); " />