<script type="text/javascript">
<!--
document.write("Hello World!");
//--
</script>
<script src="xxx.js"></script>。單行://;多行:/* ... */。
=== 表示型別與值都相等。
alert("alert"); // 警告
confirm("confirm"); // 確認
prompt("prompt","預設值"); // 可輸入文字的提示
for (變數 in 物件) {
// 在此執行程式碼
}
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() 方法:用於改變比對模式,或新增、刪除第二個參數。