在js中,可以使用typeof获取变量或函数的类型,如下:
<head runat="server">
<title></title>
<script type="text/javascript">
window.onload = function() {
var aa = 1;
var bb = "123";
alert("aa的类型: " + typeof aa +
"\nbb的类型: " + typeof bb +
"\ncc的类型: " + typeof cc); }; function cc() {
var i = 1;
} </script> </head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server" ID="txt"></asp:TextBox>
<div style="z-index: 1000;border:">
<label>hello world</label>
</div>
</div>
</form>
</body>
效果图: