11.html
来自「介绍了javascript的常用的函数」· HTML 代码 · 共 21 行
HTML
21 行
<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>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?