zoukankan
html css js c++ java
js入门·对象的综合练习(重点介绍Link对象)
1:页面载入时改变状态栏文字;
2:指向链接时改变状态栏文字;
3:打印出当前窗口的URL
4:统计本页上有多少个连接
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
>
查看全文
相关阅读:
第25周三
第25周二
第25周一
第24周日
第24周六
第24周五
第24周四经验感受想法
第24周三
第24周二
01背包问题
原文地址:https://www.cnblogs.com/thcjp/p/471277.html
最新文章
4.基于注解的控制器
3.SpringMVC介绍
1.java生成随机不重复10位字符串
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/co
Java工具类实现校验公民身份证的有效性
解决org.springframework.context.NoSuchMessageException: No message found under code 'login.validate.er
mybatis:Invalid bound statement (not found)
Eclipse中java文件和jsp字体大小设置
网页缓存技术
SQLite外键
热门文章
top使用命令
采用Flume实时采集和处理数据
Java它配备了一个很好的工具2
Java设计模式菜鸟系列(十三)建模和实现状态模式
一个临终的人的告别
Android 异步消息处理机制 让你在深入了解 Looper、Handler、Message之间的关系
新的学生说说我是如何靠APP发展赢得了亿万
数字IC设计-15-DPI(延续)
php用空格代替标点符号
第25周四
Copyright © 2011-2022 走看看