前面那兩個(gè)script是GOOGLE的廣告代碼,后面兩個(gè)是統(tǒng)計(jì)的代碼。

創(chuàng)新互聯(lián)是一家專業(yè)從事網(wǎng)站制作、成都做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)的品牌網(wǎng)絡(luò)公司。如今是成都地區(qū)具影響力的網(wǎng)站設(shè)計(jì)公司,作為專業(yè)的成都網(wǎng)站建設(shè)公司,創(chuàng)新互聯(lián)依托強(qiáng)大的技術(shù)實(shí)力、以及多年的網(wǎng)站運(yùn)營(yíng)經(jīng)驗(yàn),為您提供專業(yè)的成都網(wǎng)站建設(shè)、營(yíng)銷型網(wǎng)站建設(shè)及網(wǎng)站設(shè)計(jì)開(kāi)發(fā)服務(wù)!
你說(shuō)帶腳本的其實(shí)是個(gè)HTML文件,不是圖片文件,真正的圖片文件是0701062354147799.jpg這個(gè)。
訪問(wèn)你提供的那地址,腳本會(huì)跟著執(zhí)行,顯示了一次GOOGLE廣告,并觸發(fā)了那兩個(gè)計(jì)數(shù)器。
img src=''
script type="text/javascript"!--
google_ad_client = "pub-0804630528012297";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
//2006-12-05:
google_ad_channel = "7824471599";
google_color_border = "CDCDCD";
google_color_bg = "FFFFFF";
google_color_link = "4B4B4B";
google_color_text = "999999";
google_color_url = "0063DC";
//--/script
script type="text/javascript"
src=""
/script
br
brbr
script src=""/script
brbrbrbrbrbrbrbr
script language='JavaScript' charset='gb2312' type='text/javascript' src=';style=texttextcolor=black'/script
1.概述
循環(huán)滾動(dòng)圖片,不僅可以增添Web頁(yè)面的動(dòng)態(tài)效果,而且可以節(jié)省頁(yè)面空間,有效地保證在有限的頁(yè)面中顯示更多的圖片。
2.技術(shù)要點(diǎn)
主要應(yīng)用setTimeout()方法實(shí)現(xiàn)圖片的循環(huán)滾動(dòng)效果。setTimeout()方法的語(yǔ)法格式如下:
setTimeout(function,milliseconds,[arguments])
參數(shù)說(shuō)明:
a.
function:要調(diào)用的JavaScript自定義函數(shù)名稱。
b.
Milliseconds:設(shè)置超時(shí)時(shí)間(以毫秒為單位)。
功能:經(jīng)過(guò)超時(shí)時(shí)間后,調(diào)用函數(shù)。此值可以用clearTimeout()函數(shù)清除。
3.具體實(shí)現(xiàn)
(1)在頁(yè)面的合適位置添加一個(gè)id屬性為demo的div標(biāo)記,并在該標(biāo)記中添加表格及要要滾動(dòng)顯示的圖片。關(guān)鍵代碼如下:
div
id="demo"
style="
overflow:
hidden;
width:
455px;
height:
166px;"
table
border="0"
cellspacing="0"
cellpadding="0"
tr
td
valign="top"
id="marquePic1"
!--
要循環(huán)滾動(dòng)的圖片
--
table
width="455"
border="0"
align="center"
cellpadding="0"
cellspacing="0"
tr
align="center"
%for(int
i=1;i8;i++){%
td
img
src="Images/%=i%.jpg"
width="118"
height="166"
border="1"
/td
%}%
/tr
/table
/td
td
id="marquePic2"
width="1"/td
/tr
/table
/div
(2)編寫(xiě)自定義的JavaScript函數(shù)move(),用于實(shí)現(xiàn)無(wú)間斷的圖片循環(huán)滾動(dòng)效果。speed數(shù)值越大圖片滾動(dòng)的越快,具體代碼如下:
script
language="javascript"
var
speed=30
;
//設(shè)置間隔時(shí)間
marquePic2.innerHTML=marquePic1.innerHTML;
var
demo=document.getElementById("demo");
//獲取demo對(duì)象
function
Marquee(n){
//實(shí)現(xiàn)圖片循環(huán)滾動(dòng)的方法
if(marquePic1.offsetWidth-demo.scrollLeft=0){
demo.scrollLeft=0;
}
else{
demo.scrollLeft=demo.scrollLeft+n;
}
}
var
MyMar=setInterval("Marquee(5)",speed);
demo.onmouseover=function()
{
//停止?jié)L動(dòng)
clearInterval(MyMar);
}
demo.onmouseout=function()
{
//繼續(xù)滾動(dòng)
MyMar=setInterval("Marquee(5)",speed);
}
/script
以上所述是小編給大家介紹的JavaScript代碼實(shí)現(xiàn)圖片循環(huán)滾動(dòng)效果的相關(guān)知識(shí),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
廢話不多說(shuō)了,直接給大家貼js實(shí)現(xiàn)點(diǎn)擊圖片顯示原圖片的代碼,具體代碼如下所示:
function
DrawImage(ImgD){
var
image
=
new
Image();
image.src=ImgD.src;
var
width
=
$(ImgD).attr("width");
var
height
=
$(ImgD).attr("height");
if(width
100
height80){
ImgD.width=100;
ImgD.height=80;
ImgD.alt=image.width+"×"+image.height;
}else{
if(image.width0
image.height0){
flag=true;
if(image.width300
||
image.height200){
ImgD.width=image.width/2;
ImgD.height=image.height/2;
ImgD.alt=image.width+"×"+image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
ImgD.alt=image.width+"×"+image.height;
}
}
}
}
下面分享一段關(guān)于js實(shí)現(xiàn)上傳圖片及時(shí)預(yù)覽
!DOCTYPE
html
PUBLIC
"-//W3C//DTD
XHTML
1.0
Transitional//EN"
""
html
xmlns=""
head
meta
http-equiv="Content-Type"
content="text/html;
charset=utf-8"
/
title圖片上傳本地預(yù)覽/title
style
type="text/css"
#preview{width:260px;height:190px;border:1px
solid
#000;overflow:hidden;}
#imghead
{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);}
/style
script
type="text/javascript"
//圖片上傳預(yù)覽
IE是用了濾鏡。
function
previewImage(file)
{
var
MAXWIDTH
=
260;
var
MAXHEIGHT
=
180;
var
div
=
document.getElementById('preview');
if
(file.files
file.files[0])
{
div.innerHTML
='img
id=imghead';
var
img
=
document.getElementById('imghead');
img.onload
=
function(){
var
rect
=
clacImgZoomParam(MAXWIDTH,
MAXHEIGHT,
img.offsetWidth,
img.offsetHeight);
img.width
=
rect.width;
img.height
=
rect.height;
//
img.style.marginLeft
=
rect.left+'px';
img.style.marginTop
=
rect.top+'px';
}
var
reader
=
new
FileReader();
reader.onload
=
function(evt){img.src
=
evt.target.result;}
reader.readAsDataURL(file.files[0]);
}
else
//兼容IE
{
var
sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
file.select();
var
src
=
document.selection.createRange().text;
div.innerHTML
=
'img
id=imghead';
var
img
=
document.getElementById('imghead');
img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src
=
src;
var
rect
=
clacImgZoomParam(MAXWIDTH,
MAXHEIGHT,
img.offsetWidth,
img.offsetHeight);
status
=('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
div.innerHTML
=
"div
id=divhead
style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'/div";
}
}
function
clacImgZoomParam(
maxWidth,
maxHeight,
width,
height
){
var
param
=
{top:0,
left:0,
width:width,
height:height};
if(
widthmaxWidth
||
heightmaxHeight
)
{
rateWidth
=
width
/
maxWidth;
rateHeight
=
height
/
maxHeight;
if(
rateWidth
rateHeight
)
{
param.width
=
maxWidth;
param.height
=
Math.round(height
/
rateWidth);
}else
{
param.width
=
Math.round(width
/
rateHeight);
param.height
=
maxHeight;
}
}
param.left
=
Math.round((maxWidth
-
param.width)
/
2);
param.top
=
Math.round((maxHeight
-
param.height)
/
2);
return
param;
}
/script
/head
body
div
id="preview"
img
id="imghead"
width=100
height=100
border=0
src='%=request.getContextPath()%/images/defaul.jpg'
/div
input
type="file"
onchange="previewImage(this)"
/
/body
/html
在TRS傳頁(yè)面時(shí),如有同名,先選提示返回選項(xiàng),如有同名存在,會(huì)出現(xiàn)上傳模板失敗, ... 從網(wǎng)頁(yè)或者WORD文檔復(fù)制的信息正文需清除格式后,再發(fā)布到操作平臺(tái)上。 ... 7、當(dāng)附件作為壓縮文件上傳時(shí),一定使用.zip格式再進(jìn)行上傳才可以下載,若為.rar文件,任一后臺(tái)均不能下載
正確的代碼如下,調(diào)試通過(guò):
html
head
script language="javascript"
var imageList = new Array('iss1.jpg','2.jpg','3.jpg','4.jpg');
var imageNumber=0;
function slideShow() {
document.slideShow.src = imageList[imageNumber];
imageNumber++;
if(imageNumber==imageList.length) imageNumber=0;
window.setTimeout("slideShow()",3000);
}
/script
/head
body onLoad="slideShow()"
img name=slideShow
/body
/html
我修改了三個(gè)地方,一是在body里面增加img name=slideShow定義圖片容器,二是對(duì)數(shù)組進(jìn)行簡(jiǎn)化,三是取消了參數(shù)。
補(bǔ)充:
上面的一就是你錯(cuò)誤的地方,二是改進(jìn),三也是改進(jìn)。
方法一:圖片輪換時(shí)利用revealTrans濾鏡產(chǎn)生轉(zhuǎn)換效果:
img src="face/face1.gif" id="turn" width="200"
style="filter:revealTrans(duration=1)"
script
var obj,first,total,cn,delay=2000
function window.onload(){
obj=document.getElementById("turn") //捕獲ID為turn的對(duì)象
first=1 //第一張圖片的路徑信息
total=18 //最后一張圖片的路徑信息
cn=1 //當(dāng)前顯示的圖片路徑信息
setTimeout("change()",delay/2)
//delay/2毫秒后執(zhí)行change()函數(shù)
}
function change(){
url="face/face" //圖片路徑的前部分
suffix=".gif" //圖片的擴(kuò)展名
if(cntotal) //如果當(dāng)前圖片數(shù)字小于最后一張的圖片數(shù)字
url+=(cn+=1)+suffix //cn自增1,并連接字符串得到url
//否則如果當(dāng)前圖片數(shù)字等于最后一張的圖片數(shù)字,即輪換到最后一張時(shí)
else if(cn==total)
//cn重調(diào)為first(第一張圖片),并且連接字符串得到url
url+=(cn=first)+suffix
with(obj.filters.revealTrans){
apply() //捕獲對(duì)象內(nèi)容的初始顯示,為轉(zhuǎn)換做必要的準(zhǔn)備
//revealTrans濾鏡的轉(zhuǎn)換效果,0到22為23種效果,
//23為23種效果的隨機(jī)一種
transition=23
obj.src=url //設(shè)置圖片的路徑
play() //開(kāi)始轉(zhuǎn)換。
}
setTimeout("change()",delay)//delay毫秒后再次執(zhí)行change()函數(shù)
}
/script
方法二:利用wipe濾鏡進(jìn)行左右擦洗式輪換
img src="face/face1.gif" id="turn" width="200"
style="filter:progid:DXImageTransform.Microsoft.Wipe(GradientSize=.5, wipeStyle=0, motion=’forward’)"
script
var obj,first,total,cn,delay=2000
function window.onload(){
obj=document.getElementById("turn")//捕獲ID為turn的對(duì)象
first=1 //第一張圖片的路徑信息
total=18 //最后一張圖片的路徑信息
cn=1 //當(dāng)前顯示的圖片路徑信息
setTimeout("change()",delay/2)//delay/2毫秒后執(zhí)行change()函數(shù)
}
function change(){
url="face/face" //圖片路徑的前部分
suffix=".gif" //圖片的擴(kuò)展名
if(cntotal) //如果當(dāng)前圖片數(shù)字小于最后一張的圖片數(shù)字
url+=(cn+=1)+suffix //cn自增1,并連接字符串得到url
//否則如果當(dāng)前圖片數(shù)字等于最后一張的圖片數(shù)字,即輪換到最后一張時(shí)
else if(cn==total)
//cn重調(diào)為first(第一張圖片),并且連接字符串得到url
url+=(cn=first)+suffix
with(obj.filters[0]){
apply() //捕獲對(duì)象內(nèi)容的初始顯示,為轉(zhuǎn)換做必要的準(zhǔn)備
duration=delay/1000//設(shè)置轉(zhuǎn)換完成所用的時(shí)間為delay/1000秒
//用這個(gè)方法實(shí)現(xiàn)左右互換擦除的效果
motion={reverse:’forward’,forward:’reverse’}[motion]
obj.src=url //設(shè)置圖片的路徑
play() //開(kāi)始轉(zhuǎn)換。
}
setTimeout("change()",delay)//delay毫秒后再次執(zhí)行change()函數(shù)
}
/script
注意:圖片名必須帶有數(shù)字規(guī)律,而且擴(kuò)展名一致。
提示:方法二的左右擦洗輪換的詳細(xì)實(shí)現(xiàn)過(guò)程主要是依靠自定義對(duì)象的簡(jiǎn)略式寫(xiě)法。假設(shè)motion的當(dāng)前值為"reverse",則
motion={reverse:’forward’,forward:’reverse’}[motion]
相當(dāng)于
motion={reverse:’forward’,forward:’reverse’}["reverse"]
即
motion="forward"
如果motion的當(dāng)前值為"forward",則
motion={reverse:’forward’,forward:’reverse’}[motion]
相當(dāng)于
motion={reverse:’forward’,forward:’reverse’}["forward"]
即
motion="reverse"
所以motion的值就在"reverse"和"forward"之間不斷輪換
特別提示
方法一的代碼運(yùn)行后,face文件夾下的圖片face1.gif到face18.gif將從第一張到最后一張每?jī)擅胼啌Q一次,并且每次輪換的轉(zhuǎn)換效果是23種轉(zhuǎn)換效果里的隨機(jī)一種。方法二的代碼運(yùn)行后,除了轉(zhuǎn)換的效果是左右輪換式的擦洗效果,其它情況同方法一。:
圖片輪換的圖片文件名通常是有規(guī)律的序列,比如說(shuō)是從1到N,然后設(shè)置定時(shí)器,每隔一段時(shí)間換一張圖片,圖片文件名作為一個(gè)自加變量,在輪換完后再?gòu)念^開(kāi)始。另外在任意兩張圖片的輪換時(shí)還會(huì)有一些轉(zhuǎn)換的過(guò)渡效果,這個(gè)主要依靠轉(zhuǎn)換濾鏡來(lái)實(shí)現(xiàn)。
或者看看這里:
網(wǎng)站題目:圖片含javascript代碼,圖片隱寫(xiě)js代碼
網(wǎng)站鏈接:http://chinadenli.net/article3/dsehjis.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、App設(shè)計(jì)、服務(wù)器托管、網(wǎng)站維護(hù)、云服務(wù)器、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)