DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript基礎知識 >> JavaScript基本入門語法集合第1/3頁
JavaScript基本入門語法集合第1/3頁
編輯:JavaScript基礎知識     
創建腳本塊
<script language=”JavaScript”>
JavaScript code goes here
</script>
隱藏腳本代碼

<script language=”JavaScript”>
<!--
document.write(“Hello”);
// -->
</script>

浏覽器不支持的時候顯示

<noscript>
Hello to the non-JavaScript browser.
</noscript>

鏈接外部腳本文件

<script language=”JavaScript” src="/”youname.js"”></script>

注釋腳本

// This is a comment
document.write(“Hello”); // This is a comment
/*
All of this
is a comment
*/

輸出到浏覽器

document.write(“<strong>輸出內容</strong>”);

定義變量

var myVariable = “some value”;

字符串相加

var myString = “String1” + “String2”;

字符串搜索

<script language=”JavaScript”>
<!--
var myVariable = “Hello there”;
var therePlace = myVariable.search(“there”);
document.write(therePlace);
// -->
</script>

字符串替換

thisVar.replace(“Monday”,”Friday”);
當前1/3頁 123下一頁閱讀全文
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved