文档详情

JavaScript的几个基础代码实例.docx

发布:2025-04-13约1.43万字共35页下载文档
文本预览下载声明

!DOCTYPEhtml

html

head

/head

body

script

for(vari=1;i21;i++){

if(i10){

document.write(imgsrc=face0+i+.gif);

}

else{

document.write(imgsrc=face+i+.gif);

}

if(i%5==0)

document.write(br);

}

/script

/body

/html

!DOCTYPEhtml

htmllang=en

head

metacharset=UTF-8

titleDocument/title

style

*{

margin:0;

padding:0;

}

ul{

list-style:none;

}

#goods_show{

width:430px;

margin:0auto;

}

#small_pic{

margin-top:20px;

}

#small_picli{

float:left;

margin:09px;

border:1px;

}

#small_picimg{

border:2pxsolid#fff;

}

/style

script

window.onload=function(){

varimg=document.getElementById(small_pic).getElementsByTagName(img);

for(vari=0;iimg.length;i++){

img[i].onmouseover=change;

}

}

functionchange(){

varimg=document.getElementById(small_pic).getElementsByTagName(img)

for(vari=0;iimg.length;i++){

img[i].style.borderColor=#fff;

}

varbigpic=document.getElementById(big_pic).getElementsByTagName(img)[0];

=red;

bigpic.src=(small,big);

//window.alert(133);

}

/script

/head

body

divid=goods_show

divid=big_picimgsrc=img/1_big.jpgalt=/div

ulid=small_pic

liahref=#imgsrc=img/1_small.jpgalt=/a/li

liahref=#imgsrc=img/2_small.jpgalt=/a/li

liahref=#imgsrc=img/3_small.jpgalt=/a/li

liahref=#imgsrc=img/4_small.jpgalt=/a/li

liahref=#imgsrc=img/5_small.jpgalt=/a/li

/ul

/div

/body

/html

!doctypehtml

htmllang=en

head

metacharset=UTF-8

/head

style

div{

width:75px;

float:left;

}

select{

width:75px;

height:100px;

}

#width{

width:30px;

height:20px;

margin:80px40px;

}

/style

script

/*varName=newArray();

Name[0]=李四;

Name[1]=王五;

Name[2]=向向;

Name[3]=多多;

window.onload=function(){

//alert(Name.length);

varcan=document.getElementsByName(candidate)[0];

for(vari=0;iName.length;i++){

varnewoption=

显示全部
相似文档