亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

javascript基礎(chǔ)知識(shí)整理

 更新時(shí)間:2010年06月04日 01:41:35   作者:  
這篇文章對(duì)于剛開(kāi)始學(xué)習(xí)js的朋友,非常有幫助,主要知識(shí)點(diǎn)都已經(jīng)整理好了。

1 創(chuàng)建腳本塊
程序代碼

復(fù)制代碼 代碼如下:

<script language="JavaScript">
JavaScript 代碼寫(xiě)在這里面
</script>

2 隱藏腳本代碼
程序代碼

在不支持JavaScript的瀏覽器中將不執(zhí)行相關(guān)代碼
3 瀏覽器不支持的時(shí)候顯示
程序代碼
復(fù)制代碼 代碼如下:

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

4 鏈接外部腳本文件
程序代碼
復(fù)制代碼 代碼如下:

<script language="JavaScript" src="/"filename.js""></script>

5 注釋腳本
程序代碼
復(fù)制代碼 代碼如下:

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

6 輸出到瀏覽器
程序代碼
復(fù)制代碼 代碼如下:

document.write("<strong>Hello jb51 .net</strong>");

7 定義變量
程序代碼
復(fù)制代碼 代碼如下:

var myVariable = "some value";

8 字符串相加
程序代碼
復(fù)制代碼 代碼如下:

var myString = "String1" + "String2";

9 字符串搜索
程序代碼

10 字符串替換
程序代碼
復(fù)制代碼 代碼如下:

thisVar.replace("Monday","Friday");

11 格式化字串
程序代碼

12 創(chuàng)建數(shù)組
程序代碼

13 數(shù)組排序
程序代碼

14 分割字符串
程序代碼

15 彈出警告信息
程序代碼

16 彈出確認(rèn)框
程序代碼

17 自定義函數(shù)
程序代碼

18 調(diào)用JS函數(shù)
程序代碼
復(fù)制代碼 代碼如下:

<a href="#" onClick="functionName()">Link text</a>
<a href="/"javascript:functionName"()">Link text</a>

19 在頁(yè)面加載完成后執(zhí)行函數(shù)
程序代碼
復(fù)制代碼 代碼如下:

<body onLoad="functionName();">
Body of the page
</body>

20 條件判斷
程序代碼

21 指定次數(shù)循環(huán)
程序代碼