首页 > 代码库 > 商品评价小星星打分js
商品评价小星星打分js
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>星星打分</title> <style type="text/css"> .evalInfo{ font-size: 13px; font-family: ‘宋体‘; margin: 3 5px; } </style> <script type="text/javascript">/** 用星星的方式来打分, **/function evalSorce(rootEle, oEvent, targetObjId,attitudeTitleId) { var imgs = rootEle.getElementsByTagName("img"); //var e = oEvent || window.event; var eventTarget = window.event.srcElement||eventTag.target; var clickedImgValue = eventTarget.value; for(var i=0; i<imgs.length; i++) { var tempImg = imgs[i]; if(tempImg.value <= clickedImgValue){ tempImg.src =‘/JSTest/img/bright.gif‘; }else { tempImg.src =‘/JSTest/img/dark.gif‘; } } var targetObj = document.getElementById(targetObjId); targetObj.value = clickedImgValue; var attitudeTitle = document.getElementById(attitudeTitleId); attitudeTitle.innerHTML = eventTarget.title; }</script> </head> <body> <input name="attitude" id="attitudeId" value="0"> <span onclick="evalSorce(this, event, ‘attitudeId‘,‘attitudeTitle‘)"> <img title="非常差" value=‘1‘ src=‘/JSTest/img/dark.gif‘ /> <img title="较差" value=‘2‘ src=‘/JSTest/img/dark.gif‘ /> <img title="一般" value=‘3‘ src=‘/JSTest/img/dark.gif‘ /> <img title="较好" value=‘4‘ src=‘/JSTest/img/dark.gif‘ /> <img title="非常好" value=‘5‘ src=‘/JSTest/img/dark.gif‘ /> <span id="attitudeTitle" class=‘evalInfo‘></span> </span> </body></html>
摘自:http://www.cnblogs.com/java-boy/archive/2011/09/01/2162578.html
商品评价小星星打分js
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。