判断javascript变量是否定义: <script type="text/javascript"> // 判断 $ 变量是否定义 if('undefined'==typeof($)) { // 没有定义 } </script>