Jav aScript 方法和技巧大全 1 创建脚本块 1: 2 隐藏脚本代码 1: 在不支持 JavaScript 的浏览器中将不执行相关代码 3 浏览器不支持的时候显示 1:
4 链接外部脚本文件 1: 5 注释脚本 1: // This is a comment 2: document.write(“ Hello” ); // This is a comment 3: /* 4: All of this 5: is a comment 6: */ 6 输出到浏览器 1: document.write(“
Hello”); 7 定义变量 1: var myVariable = “some value”; 8 字符串相加 1: var myString = “String1” + “String2”; 9 字符串搜索 1: 10 字符串替换 1: thisVar.replace(“Monday”,”Friday”); 11 格式化字串 1: