<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2" %>
<!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 runat="server">
<title></title>
<script type="text/javascript">
function abc()
{
var a=document.getElementById("test");
if (a != null) {
alert("不为空");
//不为空
}
else {
alert("为空");
//为空
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
<br />
<div id="tetDiv" runat="server" style="background-color: Blue;">
测试层
</div>
<input type="button" value="点击" οnclick="abc()" />
</div>
</form>
</body>
</html>