JavaScript 参考手册
JavaScript undefined 属性
检测变量是否定义
源代码:
点击运行 »
<script> var t1 = ""; var t2; if (t1 === undefined) { alert("t1 is undefined"); } if (t2 === undefined) { alert("t2 is undefined"); } </script>
运行结果:
点击运行 »