已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年浙江温州市乐清市教育研究培训院选调研训员2名的笔试模拟试题及答案详解
- 2026年伊春市乌伊岭区网格员招聘笔试备考试题及答案详解
- 2026吉林省彩虹人才开发咨询服务有限公司招聘劳务派遣制岗位工作人员4人笔试备考试题及答案详解
- 2026浙江温州海关综合技术服务中心招聘编外人员2人笔试模拟试题及答案详解
- 2026泰兴市新源农产品加工投资发展有限公司招聘专业添加目录笔试参考题库及答案详解
- 2026四川宜宾市珙县县属国有企业第一次招聘调整部分岗位开考比例等相关事宜笔试备考试题及答案详解
- 2025年鸡西市滴道区网格员招聘考试试题及答案详解
- 2026福建雁翔实业发展集团有限公司所属企业招聘管理及专业技术人员1人补充笔试参考题库及答案详解
- 2026中国人民大学人事处国际交流合作部(港澳台办公室)招聘1人笔试模拟试题及答案详解
- 2026四川宜宾南溪区农业农村领域高校毕业生就业岗位招聘15人(第二批)笔试模拟试题及答案详解
- 异常工况安全处置准则解读
- 窜货联保协议书
- 《经济学导论》教学课件
- 三体系基础知识培训课件
- 建设工程施工合同GF-2024-0201住建部
- 煤矿师傅带徒弟管理制度
- 广东2025年01月广东省廉江市人力资源和社会保障局等2个单位2025年公开招考政府雇员笔试历年典型考题(历年真题考点)解题思路附带答案详解
- 高血压社区规范化管理与药物治疗
- 保险顺延申请书范本
- DBJ41-T 099-2010 河南省附属绿地绿化规划设计规范
- 《冲击波治疗骨肌疾病技术规范》
评论
0/150
提交评论