用jquery写的评分规则,代码如下:
$(function () {
$("#star td").html('<img src="../Images/starEmpty2.PNG" />').mouseover(function () {
var selectLen = $("#star td:checked").length;
$("#star td").html('<img src="../Images/starFull2.PNG" />');
$(this).html('<img src="../Images/starHalf2.PNG" />');
$(this).nextAll().html('<img src="../Images/starEmpty2.PNG" />');
});
})
<table>
<tr id="star">
<td></td><td></td><td></td><td></td><td></td>
</tr>
</table>
要求效果:一般网页上的评分效果,当前图片为Full,然后为Half,最后为Full
$(function () {
$("#star td").html('<img src="../Images/starEmpty2.PNG" />').mouseover(function () {
var selectLen = $("#star td:checked").length;
$("#star td").html('<img src="../Images/starFull2.PNG" />');
$(this).html('<img src="../Images/starHalf2.PNG" />');
$(this).nextAll().html('<img src="../Images/starEmpty2.PNG" />');
});
})
<table>
<tr id="star">
<td></td><td></td><td></td><td></td><td></td>
</tr>
</table>
要求效果:一般网页上的评分效果,当前图片为Full,然后为Half,最后为Full
解决方案 »
- 求助!求助!jquery weebox 在IE下面弹框总是加载不了
- 如何实现DIV跟随滚动,到网页底部的时候固定
- js控制select下拉菜单无法显示
- 这个sql怎么会报错那?
- 为什么 document.body.appendChild() 时页面不能有没闭合的 <p>
- JS测试多选框的个数为什么会这样?
- confirm实现确认和取消功能,可是要是我需要确认\忽略和取消三个按扭功能,应该怎么实现?谢谢
- 谁能给我一份关于图片绝对定位的代码?谢谢了!
- 如何自动保存网页或从缓存取得相关页面?
- js中有关日起转换的函数,有无日期比较函数
- ie7,ie8下js报错:SCRIPT438: 对象不支持此属性或方法
- 求大拿指点
1.<td></td><td></td><td></td><td></td><td></td>添加mouseover mouseout事件
2.mouseover中把该元素和前面的<td>都使用starFull2.PNG(不要用<img>,使用<td style="fullclass"> .fullclass{background属性中中放上背景图片}),该元素后td都使用starEmpty2.PNG 即emptyclass
3 mouseout 中展示该内容的得分,根据分数来算需展示的星星,包括starHalf2.PNG 半个星星,算法如2类似,取分值的整数展示starfull,下一个td中 小数 <0.25无starHalf,>0.25 && <0.75 展示starHalf,>0.75 展示starfull,之后td展示starempty
4 您给的分太少了啊