已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实验5 JavaScript综合实验1. 编写一个HTML网页,在打开该网页时弹出一个广告页面(自行设计一个广告页面),该广告页面没有菜单栏、工具栏、地址栏和状态栏,且不能改变其大小。var ClickSuccess = false;var opened = false;function myclick() if (!opened & !ClickSuccess) if (window.Event) top.document.captureEvents(Event.CLICK); document.captureEvents(Event.CLICK); top.document.onclick = goto; document.onclick = goto; self.focus(); ClickSuccess=true; function goto() if (!opened) popwin = window.open();/此处就是要弹出页面的广告地址,自己加上吧。 if (popwin) opened = true; /self.focus(); myclick();2. 编写一个HTML网页,在网页中增加一个动态的时间显示,要求显示格式为“当前日期:2015-05-06,当前时间:17:20:08”,且当月、日、时、分或秒中出现一位数字时,自动在该数字前面补一个0,例如“2015-05-06”及“09:08:02”。无标题文档function shizhong()var date = new Date();document.getElementById(timediv).innerHTML=date.toLocaleString();setTimeout(shizhong(),1000);3. 编写一个HTML网页,在网页的左右两端各增加一张图片广告,且这两张图片广告可以跟随页面一起上下滚动,无论页面滚动到何处,图片在浏览器中的显示位置相对固定。var newtop=0; var newleft=0; if (navigator.appName = Netscape) ; layerStyleRef=layer.;layerRef=document.layers; styleSwitch=; ; else; ; layerStyleRef=layer.style.; layerRef=document.all;styleSwitch=.style; ; function doMouseMove() ; layerName = iit; eval(var curElement=+layerRef+layerName+)eval(layerRef+layerName+styleSwitch+.visibility=hidden); eval(curElement+styleSwitch+.visibility=visible)eval(newleft=document.body.clientWidth-curElement+styleSwitch+.pixelWidth)eval(newtop=document.body.clientHeight-curElement+styleSwitch+.pixelHeight)eval(height=curElement+styleSwitch+.height)eval(width=curElement+styleSwitch+.width) width=parseInt(width) height=parseInt(height) if (event.clientX (document.body.clientWidth - 5 - width) newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width else newleft=document.body.scrollLeft + event.clientX eval(curElement+styleSwitch+.pixelLeft=newleft) if (event.clientY (document.body.clientHeight - 5 - height) newtop=document.body.clientHeight + document.body.scrollTop - 5 - height else newtop=document.body.scrollTop + event.clientY eval(curElement+styleSwitch+.pixelTop=newtop) document.onmousemove = doMouseMove; if (navigator.appName = Netscape) else document.write()document.write() document.write() 4. 编写一个HTML网页,当鼠标在页面上移动时,有一张图片跟随鼠标一起移动。var newtop=0; var newleft=0; if (navigator.appName = Netscape) ; layerStyleRef=layer.;layerRef=document.layers; styleSwitch=; ; else; ; layerStyleRef=layer.style.; layerRef=document.all;styleSwitch=.style; ; function doMouseMove() ; layerName = iit; eval(var curElement=+layerRef+layerName+)eval(layerRef+layerName+styleSwitch+.visibility=hidden); eval(curElement+styleSwitch+.visibility=visible)eval(newleft=document.body.clientWidth-curElement+styleSwitch+.pixelWidth)eval(newtop=document.body.clientHeight-curElement+styleSwitch+.pixelHeight)eval(height=curElement+styleSwitch+.height)eval(width=curElement+styleSwitch+.width) width=parseInt(width) height=parseInt(height) if (event.clientX (document.body.clientWidth - 5 - width) newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width else newleft=document.body.scrollLeft + event.clientX eval(curElement+styleSwitch+.pixelLeft=newleft) if (event.clientY (document.body.clientHeight - 5 - height) newtop=document.body.clientHeight + document.body.scrollTop - 5 - height else newtop=document.body.scrollTop + event.clientY eval(curElement+styleSwitch+.pixelTop=newtop) document.onmousemove = doMouseMove; if (navigator.appName = Netscape) else document.write()document.write() document.write() 5. 编写一个HTML网页,在该网页上有一张图片,且在浏览器状态栏中显示有关图片的说明文字。单击图片时,将更换成另一张图片,同时状态栏的内容也做相应的变更。var newtop=0; var newleft=0; if (navigator.appName = Netscape) ; layerStyleRef=layer.;layerRef=document.layers; styleSwitch=; ; else; ; layerStyleRef=layer.style.; layerRef=document.all;styleSwitch=.style; ; function doMouseMove() ; layerName = iit; eval(var curElement=+layerRef+layerName+)eval(layerRef+layerName+styleSwitch+.visibility=hidden); eval(curElement+styleSwitch+.visibility=visible)eval(newleft=document.body.clientWidth-curElement+styleSwitch+.pixelWidth)eval(newtop=document.body.clientHeight-curElement+styleSwitch+.pixelHeight)eval(height=curElement+styleSwitch+.height)eval(width=curElement+styleSwitch+.width) width=parseInt(width) height=parseInt(height) if (event.clientX (document.body.clientWidth - 5 - width) newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width else newleft=document.body.scrollLeft + event.clientX eval(curElement+styleSwitch+.pixelLeft=newleft) if (event.clientY (document.body.clientHeight - 5 - height) newtop=document.body.clientHeight + document.body.scrollTop - 5 - height else newtop=document.body.scrollTop + event.clientY eval(curElement+styleSwitch+.pixelTop=newtop) document.onmousemove = doMouseMove; if (navigator.appName = Netscape) else document.write()document.write() document.write() 6. 编写一个HTML网页,在网页中显示一个注册表单,包括“用户名”、“密码”、“确认密码”、“QQ号码”、“电子邮箱”五个文本框或密码框,以及如下所示图片按钮。用户注册function IsDigit(cCheck)return (0=cCheck) & (cCheck=9);function IsAlpha(cCheck)return (a=cCheck) & (cCheck=z) | (A=cCheck) & (cCheck=Z)function IsValid()var struserName = reg.UserName.value;for (nIndex=0; nIndexstruserName.length; nIndex+)cCheck = struserName.charAt(nIndex);if (!(IsDigit(cCheck) | IsAlpha(cCheck)return false;return true;function chkEmail(str)return str.search(/w-1,w-1,.w-1,/)=0?true:falsefunction docheck()if(reg.UserName.value=)alert(请填写用户名);return false;else if(!IsValid()alert(用户名只能使用字母和数字);return false;else if(reg.UserPassword.value=)alert(请填写密码);return false;else if(reg.UserPassword.value != reg.CUserPassword.value)alert(两次密码不一致);return false;else if(reg.NickName.value =)alert(请填写昵称);return false;else if(reg.Email.value =)alert(请填写邮箱);return
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 饲草种子繁育工岗中水平考核试卷含答案
- 儿童牙刷清仓活动方案策划(3篇)
- 儿童冬装清仓方案策划活动(3篇)
- 公益活动剪发策划方案(3篇)
- 分接开关施工方案(3篇)
- 产后出血应急预案纸质(3篇)
- 1-1-Sulfinylbis-1H-imidazole-Clotrimazole-Impurity-20-生命科学试剂-MCE
- 厂房窗户防水施工方案(3篇)
- 喷漆房使用应急预案(3篇)
- 地下喷涂支护施工方案(3篇)
- 物业中控外包合同
- AQ 3026-2026《化工企业设备检修作业安全规范》解读课件
- 经营服务费合同范本
- 《电气工程及其自动化专业导论 第2版》课件 -第2章 电机电器及其控制
- 外墙外保温系统应用技术标准(岩棉) DG-TJ08-2126-2023
- 死亡病例讨论病例汇报
- 2025石家庄市正定县正定镇社区工作者考试真题
- 汽车和解协议书范本
- 《工程造价指标分类及编制指南》附录A 房屋建筑工程
- UL1977标准中文版-2019连接器UL中文版标准
- 中国食物成分表2018年(标准版)第6版
评论
0/150
提交评论