




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 临床应用西医临床试题及答案解析
- 清晰思维的初级会计师试题及答案
- 农业市场竞争中的品牌建设与维护试题及答案
- 知识体系构建信息系统项目管理师试题及答案
- 2025年临床执业医师考试职业素养试题及答案
- 2025-2030中国电子信息制造行业市场深度调研及发展趋势与投资前景预测研究报告
- 2025-2030中国电动车行驶记录仪行业市场发展趋势与前景展望战略研究报告
- 2025-2030中国电动汽车驱动装置行业市场发展趋势与前景展望战略研究报告
- 公共营养师考试的考核标准试题及答案
- 2025-2030中国电力自动化行业市场深度调研及发展趋势与投资策略研究报告
- 电信行业用户欠费催收策略与措施
- 银行资格考试分析与策略试题及答案
- 多式联运风险管理与优化-全面剖析
- 岳楼小学建立学校年级班级家长四级防控工作联系网络实施方案
- 病人走失应急预案
- 2025年中国铁塔考试试题及答案
- 2025年博士思政面试题及答案
- 专题12 将军饮马模型(解析版)
- 广东省深圳市深圳实验学校等校联考2024-2025学年九年级下学期开学考试语文试题(含答案)
- 2025年浙江安防职业技术学院单招职业倾向性测试题库1套
- 《园林景观手绘技法表现》课件-项目2 景观元素的表现技法
评论
0/150
提交评论