当前位置: 首页 > 图文教程 > 网络编程 > Javascript > JavaScript 小技巧(第一集)

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 JavaScript 小技巧(第一集)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-10   浏览: 349 ::
收藏到网摘: n/a

  第一集 如何用滑鼠控制Web页面

  在这一部分首先要为你展示的JavaScript特性是将你的滑鼠移到这个不同颜色的连结上面,此时看看浏览器下的状态列有何结果,然后这样的功能我们可以与JavaScript的功能相结合。怎样做到的呢 以下就是这一个连结的作法:
   <a href="tpage.htm" onMouseOver="window.status='Just another stupid link...'; return true">
  在这儿你只要在传统 <a> 的标签中加入 onMouseOver 的 method 就可达成你要的效果了。这里的 window.status 是用来让你可以在 WWW 浏览器的状态列上显示一些讯息用的。

  在语法中,你可以看到讯息部分是用 ' 括起来的部分,而非以 " 括起来。在讯息部分结束之后,必须加上 ; return true。好了,利用以上的特性可以很简单的完成第二个连结的例子,相当简单。以onMouseOver 的 method ,然后配合事件发生时去呼叫函数 hello() 就行了,不再多加解释了。 

作法如下 

 <html>
 <head>
 <script language="LiveScript">
 <!-- Hiding
 function hello() {
 alert("哈罗!");
 }
 </script>
 </head>
 <body>
 <a href="" onMouseOver="hello()">link</a>
 </body>
 </html>