网站导航网学 原创论文 原创专题 网站设计 最新系统 原创论文 论文降重 发表论文 论文发表 UI设计定制 论文答辩PPT格式排版 期刊发表 论文专题
返回网学首页
网学原创论文
最新论文 推荐专题 热门论文 论文专题
当前位置: 网学 > 交易代码 > ASP精品代码 > 正文

浏览器对象

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务
uot;stopit()">
  </p>
  </form>
  </body>
  </html>
  将上述程序稍加更改,可以创建定时闹钟程序(chapter03/section4/ clertclock.asp)
  <html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <title>时钟</title>
  <script language="JavaScript">
  var timer;
  function clock()  {
  var timestr="";
  var now=new Date();
  var hours=now.getHours();
  var minutes=now.getMinutes();
  var seconds=now.getSeconds();
  timestr+=hours;
  timestr+=((minutes<10)? ":0" : ":")+minutes;
  timestr+=((seconds<10)? ":0" : ":")+seconds;
  window.document.frmclock.txttime.value=timestr;
  if (window.document.frmclock.settime.value==timestr)  {
  window.alert("起床啦!");
  }
  timer=setTimeout('clock()',1000);
  }
  function stopit()  {clearTimeout(timer);}
  </script>
  </head>
  <body>
  <form action="" method="post" name="frmclock" id="frmclock">
  <p>
  当前时间:
  <input name="txttime" type="text" id="txttime">
  </p>
  <p>设定闹钟:
  <input name="settime" type="text" id="settime">
  </p>
  <p>
  <input type="button" name="Submit" value="启动始终" onclick="clock()">
  <input type="button" name="Submit2" value="停止时钟" onclick="stopit()">
  </p>
  </form>
  </body>
  </html>
  3、location对象:该对象包含有当前网页的URL(统一资源定位器,即网址)。
  属性: href   用于指定导航到的网页(chapter03/section4/ frontpage.asp)
  举例:
  <body>
  <a href=#  onClick="Javascript:window.location.href='nextpage.asp'">按此处到下一个页面</a>
  </body>
  4、history对象:该对象包含有最近10个网页的URL的地址。常用的方法为go(数值)方法,数值为负数往回,等价于浏览器中的“后退”。
  举例:
  <body>(chapter03/section4/ nextpage.asp)
  <a href=#  onClick="Javascript:window.history.go(-1)">该网页是跳转后的页面,请按此处回到上一个页面!</a>
  </body>
  5、external对象:该对象有一个常用的addFavorite方法,利用该方法,可实现将指定的网页添加到收藏夹中
  <body>(chapter03/section4/ externalpage.asp)
  这是一个值得珍藏的网页!<a href=#  onClick="Javascript:window.external.addFavorite('http://www.ahip.cn','安徽工业职业技术学院')">点击珍藏</a>
  </body>
  6、document对象:代表当前网页,其常用方法为write用于在当前页面中输出HTML语句;
  <script language="javascript">(chapter03/section4/document.asp)
  var curday=new Date();
  document.write("今天是:");
  switch(curday.getDay())  {
  case 1:
  document.write("星期一");break;
  case 2:
  document.write("星期二");break;
  case 3:
  document.write("星期三");break;
  case 4:
  document.write("星期四");break;
  case 5:
  document.write("星期五");break;
  case 6:
  document.write("<font color='FF0000'>星期六</font>");break;
  case 0:
  document.write("<font color='FF0000'>星期日</font>");break;
  }
  </script>
  7、JavaScript的事件处理
  (1)事件及响应方法
  JavaScript采用了事件驱动的响应机制,用户在网页中的交互操作,将触发相应的事件,当事件发生时,系统会调用执行对应的事件处理函数。
  事件:由系统预先定义好的,能被对象识别的一种动作。
  事件的类别:系统事件(Load,Unload)和用户事件(MouseOver,MouseOut,MouseDown、MouseUp,Click,
  • 上一篇资讯: VBScript程序设计
  • 下一篇资讯: JavaScript脚本语言
  • 设为首页 | 加入收藏 | 网学首页 | 原创论文 | 计算机原创
    版权所有 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2020 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号 常年法律顾问:王律师