Dhtml网页实例教程(6)

来源:动态WEB脚本技术论坛 时间:2007-10-09 13:39:00 

Dhtml实例教程(六)

例8 对列表进行动态变换


<html>
<head>
<title>DHtml举例8</title>
<style>
body {font-family:"宋体";font-size:9pt}
.first {color:gray;text-decoration:none}
.later {cursor:hand;color:blue;text-decoration:underline}
</style>
<script language="JavaScript">
function change_text(){
if(window.event.srcElement.className=="first"){
window.event.srcElement.className="later";
}
else
{
window.event.srcElement.className="first";
}
}
document.onmouseover=change_text;
document.onmouseout=change_text;
</script>
</head>
<body>
<br>
<ul>
<li class=first> 动态Html(DHtml)
<li class=first> JavaScript
<li class=first> VBScript
<li class=first> 动态服务器页面(ASP)
<li class=first> FrontPage98
<li class=first> InternetExplorer
<li class=first> SQL Server
</ul>
</body>
</html>


本例中的特别之处在于蓝色字部分。CSS样式单首先定义了<body></body>标志对的样式(body {font-family:"宋体";font-size:9pt}),然后定义了另外两个样式类“first”和“later”,first类中的文本修饰是none,既没有修饰,而later的文本修饰是underline,及下加一条直线,并且,later类中还出现了cursor属性,其值为hand,即是网页中鼠标移到超级链结是出现的小手。除了小手外,cursor还可以取其它的值:default、hand、move、crosshair、text、wait、help、nw-resize、n-resize、se-resize、sw-resize、s-resize、w-resize、e-resize和ne-resize等。

注意到语句 document.onmouseover=change_text;和document.onmouseout=change_text;只就是我们解决上边提到的问题的关键语句,它们代替了Html文档中所有的onmouseover和onmouseout事件。

您大可以自己设计出更好看、更动感的DHtml来,不怕做不到,就怕想不到。

标签:html,dhtml,教程
0
投稿

猜你喜欢

  • 浅谈ROC曲线的最佳阈值如何选取

    2021-10-07 07:49:29
  • Python unittest生成测试报告过程解析

    2023-02-18 13:13:17
  • Django实现文章详情页面跳转代码实例

    2023-08-29 05:41:47
  • 详解Python import方法引入模块的实例

    2021-01-10 04:21:08
  • 基于Python实现骰子小游戏

    2023-07-11 22:39:58
  • 求任意自然数内的素数

    2009-10-15 12:21:00
  • Python分析彩票记录并预测中奖号码过程详解

    2023-07-20 04:49:18
  • 如何使用PHP计算上一个月的今天

    2023-11-15 14:16:25
  • SQL 研究 相似的数据类型

    2024-01-15 11:20:44
  • 使用python将最新的测试报告以附件的形式发到指定邮箱

    2022-08-24 14:59:16
  • 如何用 Python 子进程关闭 Excel 自动化中的弹窗

    2023-10-16 15:47:32
  • GOLang IO接口与工具使用方法讲解

    2024-04-30 10:05:15
  • Python实用库 PrettyTable 学习笔记

    2021-07-02 17:36:22
  • python爬虫之request模块深入讲解

    2021-09-21 00:35:51
  • python实现udp传输图片功能

    2022-09-24 16:35:01
  • python实现的分析并统计nginx日志数据功能示例

    2023-07-30 20:08:15
  • Python版微信红包分配算法

    2022-04-10 12:48:22
  • python subprocess pipe 实时输出日志的操作

    2022-10-07 00:39:51
  • 宝丽通实现连续播放实现代码

    2022-08-14 22:17:45
  • 利用python/R语言绘制圣诞树实例代码

    2021-02-10 02:32:23
  • asp之家 网络编程 m.aspxhome.com