日期:2014-05-16  浏览次数:20435 次

这断js为什么点了层没反应
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <title>无标题页</title>
  <script language="javascript" type="text/javascript">
  function close(){
  document.getElementById('close').style.display="none";
  document.getElementById('remove').style.display="none";
  alert("有没有反映呢");
  }
  function open()
  {
  alert("什么情况"):
  document.getElementById('close').style.display="block";
  document.getElementById('remove').style.display="block";
   
  }
  </script>
</head>
<body onload="open()" >
  <form id="form1" runat="server">
  <div style="background-color:Gray; top:132px">
  <div id="remove" style=" border:4px">
  <div id="close" onclick="close()" style=" width:26px; height:18px;
 background-color:Red"></div>
  <div> <label id="labTitle" runat ="server" title="我是标题">
</label>&nbsp;
  </div>
  <div>
  <label id="labContent" runat="server" >rewrreeeeeeeeeeeeee
  eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeee</label></div>
  </div>
  </div>
  </form>
</body >
</html>

------解决方案--------------------
JScript code

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="WebForm1.aspx.cs" Inherits="WorldCup.WorldCup.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>无标题页</title>

    <script language="javascript" type="text/javascript">
  function closeDiv(){
  document.getElementById('close').style.display="none";
  document.getElementById('remove').style.display="none";
  alert("有没有反映呢");
  }
  function open()
  {
  alert("什么情况");
  document.getElementById('close').style.display="block";
  document.getElementById('remove').style.display="block";
    
  }
    </script>

</head>
<body onload="open()">
    <form id="form1" runat="server">
        <div style="background-color: Gray; top: 132px">
            <div id="remove" style="border: 4px">
                <div id="close" onclick="closeDiv()" style="width: 26px; height: 18px; background-color: Red">
                    关闭
                </div>
                <div>
                    <label id="labTitle" runat="server" title="我是标题">
                    </label>
                    &nbsp;
                </div>
                <div>
                    <label id="labContent" runat="server">
                        rewrreeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee