1
<
img src
=
"
/”image1.jpg
"
” name
=
”myImage”
>
2
<
a href
=
”# ” onClick
=
”window.alert(document.myImage.width)”
>
Width
</
a
>
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
37 动态加载图像
1
<
script language
=
”JavaScript”
>
2
myImage
=
new
Image;
3
myImage.src
=
“Tellers1.jpg”;
4
</
script
>
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
38 简单的图像替换
1
<
script language
=
”JavaScript”
>
2
rollImage
=
new
Image;
3
rollImage.src
=
“rollImage1.jpg”;
4
defaultImage
=
new
Image;
5
defaultImage.src
=
“image1.jpg”;
6
</
script
>
7
<
a href
=
"
/”myUrl
"
” onMouseOver
=
”document.myImage.src
=
rollImage.src;”
8
onMouseOut
=
”document.myImage.src
=
defaultImage.src;”
>
9
<
img src
=
"
/”image1.jpg
"
” name
=
”myImage” width
=
100
height
=
100
border
=
0
>
10
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
![None.gif](/Images/OutliningIndicators/None.gif)
39 随机显示图像
1
<
script language
=
”JavaScript”
>
2
var
imageList
=
new
Array;
3
imageList[
0
]
=
“image1.jpg”;
4
imageList[
1
]
=
“image2.jpg”;
5
imageList[
2
]
=
“image3.jpg”;
6
imageList[
3
]
=
“image4.jpg”;
7
var
imageChoice
=
Math.floor(Math.random()
*
imageList.length);
8
document.write(‘
<
img src
=
”’
+
imageList[imageChoice]
+
‘“
>
’);
9
</
script
>
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
40 函数实现的图像替换
1
<
script language
=
”JavaScript”
>
2
var
source
=
0
;
3
var
replacement
=
1
;
4![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
function
createRollOver(originalImage,replacementImage)
{
5
var imageArray = new Array;
6
imageArray[source] = new Image;
7
imageArray[source].src = originalImage;
8
imageArray[replacement] = new Image;
9
imageArray[replacement].src = replacementImage;
10
return imageArray;
11
}
12
var
rollImage1
=
createRollOver(“image1.jpg”,”rollImage1.jpg”);
13
</
script
>
14
<
a href
=
”#” onMouseOver
=
”document.myImage1.src
=
rollImage1[replacement].src;”
15
onMouseOut
=
”document.myImage1.src
=
rollImage1[source].src;”
>
16
<
img src
=
"
/”image1.jpg
"
” width
=
100
name
=
”myImage1” border
=
0
>
17
</
a
>
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](/Images/dot.gif)
5
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
6
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
7
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
8
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
9
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
10
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
11
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
12
![None.gif](/Images/OutliningIndicators/None.gif)
13
![None.gif](/Images/OutliningIndicators/None.gif)
14
![None.gif](/Images/OutliningIndicators/None.gif)
15
![None.gif](/Images/OutliningIndicators/None.gif)
16
![None.gif](/Images/OutliningIndicators/None.gif)
17
![None.gif](/Images/OutliningIndicators/None.gif)
41 创建幻灯片
1
![dot.gif](/Images/dot.gif)
2
<
script language
=
”JavaScript”
>
3
var
imageList
=
new
Array;
4
imageList[
0
]
=
new
Image;
5
imageList[
0
].src
=
“image1.jpg”;
6
imageList[
1
]
=
new
Image;
7
imageList[
1
].src
=
“image2.jpg”;
8
imageList[
2
]
=
new
Image;
9
imageList[
2
].src
=
“image3.jpg”;
10
imageList[
3
]
=
new
Image;
11
imageList[
3
].src
=
“image4.jpg”;
12![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
function
slideShow(imageNumber)
{
13
document.slideShow.src = imageList[imageNumber].src;
14
imageNumber += 1;
15![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (imageNumber < imageList.length)
{
16
window.setTimeout(“slideShow(“ + imageNumber + “)”,3000);
17
}
18
}
19
</
script
>
20
</
head
>
21
<
body onLoad
=
”slideShow(
0
)”
>
22
<
img src
=
"
/”image1.jpg
"
” width
=
100
name
=
”slideShow”
>
23![None.gif](/Images/OutliningIndicators/None.gif)
![None.gif](/Images/OutliningIndicators/None.gif)
![dot.gif](/Images/dot.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
11
![None.gif](/Images/OutliningIndicators/None.gif)
12
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](/Images/dot.gif)
13
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
14
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
15
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](/Images/dot.gif)
16
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
17
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
18
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
19
![None.gif](/Images/OutliningIndicators/None.gif)
20
![None.gif](/Images/OutliningIndicators/None.gif)
21
![None.gif](/Images/OutliningIndicators/None.gif)
22
![None.gif](/Images/OutliningIndicators/None.gif)
23
![None.gif](/Images/OutliningIndicators/None.gif)
![dot.gif](/Images/dot.gif)
42 随机广告图片
1
<
script language
=
”JavaScript”
>
2
var
imageList
=
new
Array;
3
imageList[
0
]
=
“image1.jpg”;
4
imageList[
1
]
=
“image2.jpg”;
5
imageList[
2
]
=
“image3.jpg”;
6
imageList[
3
]
=
“image4.jpg”;
7
var
urlList
=
new
Array;
8
urlList[
0
]
=
“http:
//
meil.cnblogs.com”;
9
urlList[
1
]
=
“http:
//
meil75.bokee.com”;
10
urlList[
2
]
=
“http:
//
blog.csdn.net/meil/”;
11
urlList[
3
]
=
“http:
//
meil.cnblogs.com/archive/2006/07/27/460520.html#461233”;
12
var
imageChoice
=
Math.floor(Math.random()
*
imageList.length);
13
document.write(‘
<
a href
=
”’
+
urlList[imageChoice]
+
‘“
><
img src
=
”’
+
imageList[imageChoice]
+
‘“
></
a
>
’);
14
</
script
>
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
11
![None.gif](/Images/OutliningIndicators/None.gif)
12
![None.gif](/Images/OutliningIndicators/None.gif)
13
![None.gif](/Images/OutliningIndicators/None.gif)
14
![None.gif](/Images/OutliningIndicators/None.gif)