需要的JS效果为:检测数据库内某数据,数据为0时,A标签不显示;数据为1时,A标签显示
谢谢各位

解决方案 »

  1.   


    <script type="text/javascript">
    function detect(){
    document.forms[0].submit();
    }
    </script>
    <a id="pad">xxxx</a>
    <form method="post" action="test1.asp" target="hf">
    <input type="button" value="点击" onclick="detect()"/> 
    </form>
    <iframe name="hf" style="display:none;"></iframe>
    test1.asp<%
      '数据库操作
      val = 0
    %>
    <script>
    window.onload=function(){
       var v = "<%=val%>";
       if(v=="0") parent.document.getElementById("pad").style.display = "none";
       else parent.document.getElementById("pad").style.display = "block";
    }
    </script>
      

  2.   

    下面是不是更简单。
     public string GetValue()
            {
                return "1";
            }<input type="button" value="test" style='display:<%=GetValue()=="0"?"none":"block"%>'/>