js入门·对象的综合练习(重点介绍Link对象) 1:页面载入时改变状态栏文字;2:指向链接时改变状态栏文字;3:打印出当前窗口的URL4:统计本页上有多少个连接5:利用伪链接做些类似按钮的事件(例如按了链接一,链接二的指向就改变) <%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>对象的综合练习(重点介绍Link对象)</title><script language="javascript">window.status="本演示是本章的一个综合练习";//这句写在了状态栏function linkk(){ if(confirm("是否转去天轰穿的教程博客")) { location.href="http://thcjp.cnblogs.com/"; }}function gai(){ if(confirm("下面我们将后面这个连接指向该下,所以请先看清楚最后一个链接的指向\n\t没看清楚就取消,看清楚了就确定")) { document.links[2].href="#"; }}</script><style type="text/css"><!--.STYLE1 {}{ color: #FF0000; font-weight: bold;}--></style></head><body><h1 class="STYLE1"><a href="javascript:void linkk()" onmouseover="window.status='一个关于链接的传说';return true;">这是一个关于对象的综合演示</a></h1><p> <script language="javascript">var name=prompt("请输入您的名字","");document.write("本页的完整地址是:"+location.href+",亲爱的"+name); </script>对了,这里顺便说下,LINK对象也可以用 document.links.length 这样的方法访问!为了演示方便,我们在弄个链接</p><p><a href="javascript:void gai()">天轰穿</a> <a href="http://www.hc115.com/">田洪川</a></p><p>本页共<script>document.write(document.links.length)</script> 个链接 </p></body></html>