<html>
<head>
<title>检查变量是否存在</title>
</head>
<body>
<script language="javascript">
<!--
a = "String";
b = 10;
str = typeof(a) == 'undefined' ? '不存在':'存在'
document.write('变量a:',str,'<br>');
str = typeof(b) == 'undefined' ? '不存在':'存在'
document.write('变量b:',str,'<br>');
str = typeof(c) == 'undefined' ? '不存在':'存在'
document.write('变量c:',str,'<br>');
//-->
</script>
</body>
</html>