?? tutorial4_page10.html
字號(hào):
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb_2312-80">
<meta NAME="GENERATOR" CONTENT="Microsoft FrontPage 3.0">
<title>Webmonkey: javascript: Thau's JavaScript Tutorial: Day 1</title>
<meta NAME="keywords"
CONTENT="javascript, hotwired, webmonkey, javascript, javascript tutorial, thau, dave thau, developer resource, developer, development, web
development, design, code, geek, warez, free, new, latest, news, tools,
info, tutorials, how-to, builder, web builder, pag">
<meta NAME="description"
CONTENT="Thau's JavaScript Tutorial: Day 1: Not only does Thau give the JavaScript skinny, but he'll have you writing your first script by the end of the day.">
<meta NAME="Template" CONTENT="E:\LIZEJUN\OFFICE\html.dot">
</head>
<body TEXT="#000000" LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff">
<table CELLSPACING="0" BORDER="0" CELLPADDING="3" WIDTH="623">
<tr>
<td WIDTH="58%" VALIGN="MIDDLE"><strong><font FACE="System,??" LANG="ZH-CN"
COLOR="#ff0000">第</font><font FACE="宋體" LANG="ZH-CN" COLOR="#ff0000">10</font><font
FACE="System,??" LANG="ZH-CN" COLOR="#ff0000">頁:數(shù)組在文件目標(biāo)模塊</font><font
FACE="宋體" LANG="ZH-CN" COLOR="#ff0000">(DOM)</font><font FACE="System,??" LANG="ZH-CN"
COLOR="#ff0000">中</font></strong><font FACE="System,??" LANG="ZH-CN"><br>
<!-- BYLINE --> </font><font FACE="System,??" LANG="ZH-CN" SIZE="2">作者:</font><a
HREF="mailto:thau@wired.com"><font FACE="宋體" LANG="ZH-CN" SIZE="2">Thau!</font></a><font
FACE="宋體" LANG="ZH-CN"> <!-- SEE ALSO LINKS --></font></td>
</tr>
<tr>
<td WIDTH="58%" VALIGN="TOP" BGCOLOR="#ffffff"><font FACE="System,??" LANG="ZH-CN"
SIZE="4">本例打算用圖片交換來演示數(shù)組如何介入</font><font FACE="宋體"
LANG="ZH-CN" SIZE="4">DOM</font><font FACE="System,??" LANG="ZH-CN" SIZE="4">的。如果你用的是</font><font
FACE="宋體" LANG="ZH-CN" SIZE="4">IE3.0</font><font FACE="System,??" LANG="ZH-CN"
SIZE="4">或</font><font FACE="宋體" LANG="ZH-CN" SIZE="4">Netscape2.0</font><font
FACE="System,??" LANG="ZH-CN" SIZE="4">,趕緊升級(jí)。試一下本例,看一下源碼。</font><font
FACE="宋體" LANG="ZH-CN"><p>Here's the JavaScript that's in the </font><tt>onClick=""</tt><font
FACE="宋體" LANG="ZH-CN"> in the link: </p>
</font><pre>
var change=prompt('Change which image (0 or 1)?','');
window.document.images[change].src='three.jpg';
</pre>
<font FACE="System,??" LANG="ZH-CN" SIZE="4"><p>本例打算用圖片交換來演示數(shù)組如何介入</font><font
FACE="宋體" LANG="ZH-CN" SIZE="4">DOM</font><font FACE="System,??" LANG="ZH-CN" SIZE="4">的。如果你用的是</font><font
FACE="宋體" LANG="ZH-CN" SIZE="4">IE3.0</font><font FACE="System,??" LANG="ZH-CN"
SIZE="4">或</font><font FACE="宋體" LANG="ZH-CN" SIZE="4">Netscape2.0</font><font
FACE="System,??" LANG="ZH-CN" SIZE="4">,趕緊升級(jí)。試一下本例,看一下源碼。</p>
</font><pre>
document.image_name.src = 'some_image.gif';
</pre>
<font FACE="System,??" LANG="ZH-CN" SIZE="4"><p>為了做這事,每個(gè)圖片都需命名到。若你不知要交換的圖片名,但卻知道其在</font><font
FACE="宋體" LANG="ZH-CN" SIZE="4">HTML</font><font FACE="System,??" LANG="ZH-CN"
SIZE="4">頁中的順序??梢杂盟?lt;/font><font FACE="宋體" LANG="ZH-CN" SIZE="4">DOM</font><font
FACE="System,??" LANG="ZH-CN" SIZE="4">數(shù)來指定該圖片。</p>
<p>一個(gè)</font><font FACE="宋體" LANG="ZH-CN" SIZE="4">HTML</font><font
FACE="System,??" LANG="ZH-CN" SIZE="4">文件中的第一個(gè)圖片是</font><font
FACE="宋體" LANG="ZH-CN" SIZE="4">document.images[0]</font><font FACE="System,??"
LANG="ZH-CN" SIZE="4">,第二個(gè)是</font><font FACE="宋體" LANG="ZH-CN" SIZE="4">document.images[1]</font><font
FACE="System,??" LANG="ZH-CN" SIZE="4">,如此類推。若你想知道一個(gè)文件中有多少個(gè)圖片,你可檢查圖片數(shù)組長(zhǎng)度知道:</font><font
FACE="宋體" LANG="ZH-CN" SIZE="4">document.imageslength</font><font FACE="System,??"
LANG="ZH-CN" SIZE="4">。例如,你想改變你的網(wǎng)頁中所有圖形為一個(gè)</font><font
FACE="宋體" LANG="ZH-CN" SIZE="4">Spacer GLF</font><font FACE="System,??" LANG="ZH-CN"
SIZE="4">圖片,你可以這樣做:</p>
</font><pre>
for (loop = 0; loop < document.images.length; loop++)
{
document.images[loop].src = 'spacer.gif';
}
</pre>
<font FACE="System,??" LANG="ZH-CN"><p ALIGN="JUSTIFY">清楚了吧?</p>
<p ALIGN="JUSTIFY">好。下面我們準(zhǔn)備三步是函數(shù)。函數(shù)學(xué)習(xí)中,我們要做一些練習(xí),并有一些作業(yè)。</p>
<p ALIGN="JUSTIFY">進(jìn)入<a HREF="tutorial4_page11.htm">函數(shù)</a></font><font
FACE="System,??" LANG="ZH-CN" SIZE="4">學(xué)習(xí)課程。</p>
<p><!-- PAGE X LINKS --><!-- this stuff checks if there are more pages in this story. if so, we'll
suck out the titles of those pages and build links. Right now, the maximum is
15 pages. --></font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">1</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4.htm"><font FACE="System,??" LANG="ZH-CN">第四課介紹</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- PAGE X LINKS --><!-- this stuff checks if there are more pages in this story. if so, we'll
suck out the titles of those pages and build links. Right now, the maximum is 15 pages. --><!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">2</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page2.htm"><font FACE="System,??" LANG="ZH-CN">循環(huán)介紹</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">3</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page3.htm"><font FACE="System,??" LANG="ZH-CN">循環(huán)的密碼</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">4</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page4.htm"><font FACE="System,??" LANG="ZH-CN">再談</font><font
FACE="宋體" LANG="ZH-CN">WHILE</font><font FACE="System,??" LANG="ZH-CN">循環(huán)</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">5</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page5.htm"><font FACE="宋體" LANG="ZH-CN">For </font><font
FACE="System,??" LANG="ZH-CN">循環(huán)</font></a><font FACE="System,??" LANG="ZH-CN"
SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">6</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page6.htm"><font FACE="System,??" LANG="ZH-CN">嵌套循環(huán)</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">7</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page7.htm"><font FACE="System,??" LANG="ZH-CN">循環(huán)練習(xí)</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">8</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page8.htm"><font FACE="System,??" LANG="ZH-CN">數(shù)組</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">9</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">: </font><a
HREF="tutorial4_page9.htm"><font FACE="System,??" LANG="ZH-CN">數(shù)組和循環(huán)</font></a><font
FACE="System,??" LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">10</font><font
FACE="System,??" LANG="ZH-CN">頁</font><font FACE="宋體" LANG="ZH-CN" SIZE="2">:</font><a
HREF="tutorial4_page10.html"><font FACE="System,??" LANG="ZH-CN">文件目標(biāo)模塊中的數(shù)組</font></a><font
FACE="宋體" LANG="ZH-CN" SIZE="2"><br>
<font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">12</font><font
FACE="System,??" LANG="ZH-CN">頁</font>: <a HREF="tutorial4_page12.html"><font
FACE="System,??" LANG="ZH-CN">無參數(shù)函數(shù)</font></a><font FACE="System,??"
LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">13</font><font
FACE="System,??" LANG="ZH-CN">頁</font>: <a HREF="tutorial4_page13.htm"><font
FACE="System,??" LANG="ZH-CN">參數(shù)及返回值</font></a><font FACE="System,??"
LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font><font FACE="System,??" LANG="ZH-CN">第</font><font FACE="宋體" LANG="ZH-CN">14</font><font
FACE="System,??" LANG="ZH-CN">頁</font>: <a HREF="tutorial4_page14.htm"><font
FACE="System,??" LANG="ZH-CN">多于一個(gè)參數(shù)的函數(shù)</font></a><font FACE="System,??"
LANG="ZH-CN" SIZE="2"><br>
<!-- this is a mini-template that formats each pageX link. So, if a story
has 15 pages, we need to generate 15 links to it. This is how each one
will look... --> </font></p>
<p><br>
<!-- AUTHOR TAGLINE --> </font></td>
</tr>
</table>
<font FACE="System,??" LANG="ZH-CN">
<p> </p>
</font>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -