标签:style blog http io ar color sp for java
<!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
标签:style blog http io ar color sp for java
原文地址:http://www.cnblogs.com/dnzhu/p/4157055.html