书签 分享 收藏 举报 版权申诉 / 17

类型JS复习资料.docx

  • 文档编号:30146506
  • 上传时间:2023-08-05
  • 格式:DOCX
  • 页数:17
  • 大小:18.36KB

absolute;left:

440px;top:

230px;"align="center">

show

(1)">1 

show

(2)">2 

show(3)">3 

show(4)">4

图片自动跳转

varoldnum=1;

functionmyturn()

{varnewnum=Math.round(Math.random()*4);

if(newnum==0)

{

newnum=4;

}

document.getElementById(oldnum).style.display="none";

document.getElementById(newnum).style.display="block";

oldnum=newnum;

setTimeout("myturn()",1000);}

document.write("");

document.getElementById("a").innerHTML="";

none"src="T1gZt0XhxrXXXXXXXX-80-80.png"width="80"height="80">

none"src="T1v0p0XhJeXXXXXXXX-80-80.jpg"width="80"height="80">

none"src="T1XdJ0XntaXXXXXXXX-80-80.jpg"width="80"height="80">

 

幻灯片播放图片:

varnum1=0;

varnum2=0;

varnum3=4;

varx=0;

varimagenum=newArray();

functionShow()

{

imgs=document.getElementsByTagName("img");

for(i=0;i

if(imgs[i].className!

="Img")

continue;

imagenum[num1]=imgs[i];

if(num1==0)

imgs[i].style.zIndex=10;

else

imgs[i].style.zIndex=0;

imgs[i].onclick=NextShow;

num1++;

}

}

functionNextShow()

{

imagenum[num2].style.zIndex=9;

imagenum[num3].style.zIndex=0;

num3=num2;

num2++;

if(num2>=num1)

num2=0;

imagenum[num2].style.left=490;

x=490;

imagenum[num2].style.zIndex=10;

LastShow();

}

functionLastShow(){

x=x-1;

imagenum[num2].style.left=x;

imagenum[num3].style.left=x-490;

if(x>0)

window.setTimeout("LastShow();",10);

}

window.onload=Show;

考点五:

下拉列表

functionheadImg()

{

document.f.head.src="images/head"+document.f.D1.value+".jpg";

}

请选择头像

流川枫

樱桃小丸子

晴子

工藤新一

考点六:

xml的运用

functionloadXML(xmlFile)

{

varxmlDoc;

if(window.ActiveXObject)

{

xmlDoc=newActiveXObject('Microsoft.XMLDOM');

xmlDoc.async=false;

xmlDoc.load(xmlFile);

}

elseif(document.implementation&&document.implementation.createDocument)

{

xmlDoc=document.implementation.createDocument('','',null);

xmlDoc.load(xmlFile);

}

else

{

returnnull;

}

returnxmlDoc;

}

functioncheckXMLDocObj(xmlFile)

{

varxmlDoc=loadXML(xmlFile);

if(xmlDoc==null)

{

alert('您的浏览器不支持xml文件读取,于是本页面禁止您的操作,推荐使用IE5.0以上可以解决此问题!

');

window.location.href='/Index.aspx';

}

for(i=0;i<18;i++)

{

document.write(xmlDoc.documentElement.childNodes(i).text);

document.writeln();

}

/*alert(xmlDoc.documentElement.childNodes(0).nodeName);

alert(xmlDoc.documentElement.childNodes

(1).nodeName);

alert(xmlDoc.documentElement.childNodes

(2).nodeName);*/

}

checkXMLDocObj('books.xml');

考点七:

滚动广告图片随着滚动条的滚动而移动,点击闭关按钮关闭图片。

vartopnum=0;

varcloseTop=0;

varnum=0;

functioninit(){

topnum=document.getElementById("advLayer").style.pixelTop;

closeTop=document.getElementById("closeadv").style.pixelTop;

}

functionmove(){

document.getElementById("advLayer").style.pixelTop=topnum+document.body.scrollTop;

document.getElementById("closeadv").style.pixelTop=closeTop+document.body.scrollTop;

}

functioncloseAdv(){

document.getElementById("advLayer").style.display="none"

document.getElementById("closeadv").style.display="none";

}

window.onscroll=move;

functionchoose(newnum){

if(num!

=0){

document.getElementById(num).width=80;

document.getElementById(num).height=80;

}

document.getElementById(newnum).width=160;

document.getElementById(newnum).height=160;

num=newnum;

}

functionup(picnum){

document.getElementById(num).width=160;

document.getElementById(num).height=160;

}

functiondown(picnum){

document.getElementById(num).width=80;

document.getElementById(num).height=80;

}

补充考点:

1.层的运用:

functionshowMe()

{

document.getElementById("placeLayer").style.display="block";

}

functionselectPlace(place)

{

document.myform.placeButton.value=place;

document.getElementById("placeLayer").style.display="none";

}

functioncloseMe()

{

document.getElementById("placeLayer").style.display="none";

}

12px">

 

 

 

closeMe()">关闭

selectPlace('北京')">北京

selectPlace('上海')">上海

selectPlace('广州')">广州

selectPlace('武汉')">武汉

selectPlace('成都')">成都

selectPlace('徐州')">徐州

selectPlace('深圳')">深圳

selectPlace('珠海')">珠海

2.鼠标事件:

3.总复习代码:

//当前时间的显示

functionnowTime()

{

varnow=newDate();

document.getElementById("nowtime").innerHTML=now.toLocaleString();

setTimeout("nowTime()",1000);

}

//图片随时间的改变而改变

functionchangeImage()

{

varnum=Math.floor(Math.random()*5)+1;

配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
JS 复习资料
提示  冰豆网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:JS复习资料.docx
链接地址:https://www.bdocx.com/doc/30146506.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2022 冰点文档网站版权所有

经营许可证编号:鄂ICP备2022015515号-1

收起
展开