源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Js基础学习资料

  • 时间:2021-02-13 07:49 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Js基础学习资料
1、防止不支持js的浏览器出问题可以这样处理JS代码 <script type="text/javascript"> <!-- document.write("Hello World!"); //--> </script> 2、JS放置位置: header:确保脚本被调用时已经加载 body:页面载入时就调用 外部js文件:不包含<script>标签 用法:<script src = "xxx.js">.....</sceipt> 3、注释 单行:// 多行:/*.....*/ 4、=== 全等符号 表示类型和值都相等 5、三种提示框 警告:alert("alert"); 确认:confirm("confirm"); 提示:prompt("prompt","默认值"); 6、for in 声明 for (变量 in 对象) { 在此执行代码 } 7、正则表达式 test()方法:检索字符串中的指定值,如果有返回True,否则False var patt1=new RegExp("e"); document.write(patt1.test("The best things in life are free")); exec()方法:检索字符中中的指定值,如果有返回找到的值,否则返回null var patt1=new RegExp("e"); document.write(patt1.exec("The best things in life are free")); compile()方法:用于改变检索模式和添加删除第二个参数
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部