当前位置: 首页 > 图文教程 > 网络编程 > Javascript > javascript+css好多网站用的选星星实现打分功能的函数

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+css好多网站用的选星星实现打分功能的函数


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

函数有两个参数,功能如下:
obj: img标签组的父容器,类型为DOM对象;
oEvent: event对象。
这个函数的优点是html代码可以很简洁,使用图片也可以很少,只需要两张图片。事件句柄只需要写在img的父容器上即可。演示用的图片我用的是绝对地址,各位在使用的时候改成网站的相对地址就可以了。当我们点击的时候,我用的是个alert事件。事实上,我们会在这个地方用个ajax方法,把相关的参数传到服务器端。只要把alert(this._num+1)写成sendAjax(this._num+1)就可以了。
需要的两张图片:

点击运行可以看到效果:
[Ctrl+A 全选 提示:你可先修改部分代码,再按运行]