当前位置:编程学习 > JS >>

javascript undefined变量未定易做图决方法

未定义的变量是' '如果没有值已经被指定给它。
  
  未定义的数值。
  
  未定义的字符串值是“未定义的。
  
  未定义的布尔值都是假的。
  
  未定义的变量是一种原始的值。
  
  未定义的,是经由变量值,并没有被指派给他们。
  
  未定义也是所返回正在被评估方法如果变量没有指定的值。
  
  下面的例子是测试一个变量,看它是否是未定义的。

 

<html>
    <script language="JavaScript1.3">
    <!--
    var myVariable;

    if(myVariable == undefined){
      document.write("This variable is undefined at the moment");
    }else{
      document.write("This variables value is: " + myVariable);
    }
    -->
    </script>
</html>

补充:网页制作,js教程
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,