在onload里面执行:
<SCRIPT LANGUAGE="JavaScript">
<!--
function fnInit()
{
var abc = document.getElementById("a");
abc.style.display = "";
}
//-->
</script>
</head><body onload="fnInit()"><div id="a" style="display:none">asdf</div></body></html>

解决方案 »

  1.   

    <script language=javascript>
    document.all.a.style.display = "";
    </script>
      

  2.   

    html,js都是客户端执行的,一般按其先后顺序执行。你那个js执行时,"a"对象还没有创建呢,所以出错了。
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title></head><body><div id="a" style="display:none">asdf</div></body></html>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var abc = document.getElementById("a");
    abc.style.display = "";
    //-->
    </script>
    就对了
      

  3.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title></head><body><div id="a" style="display:none">asdf</div>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var abc = document.getElementById("a");
    abc.style.display = "";
    //-->
    </script></body></html>------------------------------
    同志,你要讲究先来后到的次序啊,呵呵,或者把代码放在window.onload事件时执行,也不会有问题。window.onload=function(){
    var abc = document.getElementById("a");
    abc.style.display = "";
    }