函数是否定义:

<script type="text/javascript">
try {
if(typeof FunName === "function") { //FunName为函数名称
alert("is function");
} else {
alert("not a function");

}
} catch(e) {}
</script>
 

变量是否定义:

<script type="text/javascript">
try {
if(typeof myvalue==="undefined") { //myvalue为变量名称
alert("is value");
} else {
alert("not a value");

}
} catch(e) {}
</script>
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2021-07-30
  • 2022-12-23
猜你喜欢
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2021-10-30
  • 2022-01-29
  • 2022-12-23
相关资源
相似解决方案