日期:2014-05-19  浏览次数:20418 次

JS高手来帮下啊。
sub   bb(obj)
        if   document.getElementById(obj)   is   nothing   then
                exit   sub
        end   if
        if   document.getElementById(obj).style.display= "none "   then
                document.getElementById(obj).style.display= "block "  
                document.getElementById( "img "   &   mid(obj,3)).src= "../images/menu_open.gif "
        else
                document.getElementById(obj).style.display= "none "  
                document.getElementById( "img "   &   mid(obj,3)).src= "../images/menu_close.gif "
        end   if
       
end   sub
谁帮我改成javascript   的啊。谢谢

------解决方案--------------------
function bb(obj) {
var o = document.getElementById(obj);
if (!o) return;

if (o.style.display == "none ") {
o.style.display = "block ";
document.getElementById( "img " + obj.substring(0, 3)).src= "../images/menu_open.gif ";
} else {
o.style.display = "none ";
document.getElementById( "img " + obj.substring(0, 3)).src= "../images/menu_close.gif ";
}
}