阅读内容 

让你的链接动起来

[日期:2005-03-23] 来源:网络  作者:陈敏杰 [字体: ]
 

This is the first link!

This is the second link!

This is the third link!

This is the forth link!


 在<marquee>标记中有一个属性direction,如果将他的值赋为"up"或"down",那么就会产生字幕的效果,根据这个特性我们就能使超级联接“动”起来。但如果我们的浏览器不是IE4.0或更高版本的话,就不能产生这个效果,所以必须考虑这一情况。本例采用了VBScript,夹在“<!--”和“-->”之间的代码被传送到客户端并在客户端的机器上执行。源代码如下:
HTML
<head><title>Active HyperLink</title></head>
<body>

<SCRIPT language="VBScript">
<!--
sign="no" sign是判断浏览器是不是IE4.0或更高版本的标记
browserName = navigator.appName 获得浏览器的名称
browserVer = Cint(String(1,navigator.appVersion)) 获得浏览器的版本并将其转化为整型

If (browserName = "Microsoft Internet Explorer" and browserVer >= 4 ) Then sign="ok"
当浏览器是IE4.0或更高版本,sign="ok"
Function marqueeStart() 函数marqueeStart()的作用是当sign="ok"时创建<marquee>及其属性
If sign="ok" Then
Document.write ("<marquee id=mymarquee behavior=scroll direction=up width=400 height=100 scrollamount=1 scrolldelay=500 onmouseover=mymarquee.stop() onmouseout=mymarquee.start()>")
onmouseover=‘mymarquee.stop()’和onmouseout=‘mymarquee.start()’语句表示当鼠标移进或移出时字幕停止或卷动,scrollamount和scrolldelay分别表示字幕移动的速度和间隔
End If
End Function

F tion marqueeEnd() 函数marqueeEnd()的作用是当sign="ok"时创建</marquee>
If sign="ok" Then
Document.write ("</marquee>")
End If
End Function
-->
</SCRIPT>

<div align="center"> <!--为了美观建立一个表格,将字幕放入表格单元中-->
<center>
<table border="1" width="400" bordercolor="#FF0000" height="100">
<tr>
<td width="100%"> 
<SCRIPT language="VBScript"> 调用marqueeStart函数
<!--
marqueeStart
-->
</SCRIPT>

<p><a href="http:1">This is the first link!</a></p>
<p><a href="http:2">This is the second link!</a></p>
<p><a href="http:3">This is the third link!</a></p>
<p><a href="http:4">This is the forth link!</a></p>

<!--当浏览器不是IE4.0或更高版本时只会产生静态效果 -->

<SCRIPT language="VBScript"> 调用marqueeEnd函数
<!--
marqueeEnd
-->
</SCRIPT>
</td>
</tr>
</table>
</center>
</div>
             [下载该程序]

阅读:
录入:blue1000

推荐 】 【 打印
相关新闻      
本文评论       全部评论
发表评论
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款


点评: 字数
姓名:
Advertisement
内容查询


Advertisement