document.write('
');
document.write('
我要打分:');
document.write('
');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('
');
document.write('
打分: | 平均分:90分');
document.write('
');
document.write('
45 ');
function rate(obj, oEvent) {
//==================
// 图片地址设置
//==================
var imgSrc = 'http://www1.pconline.com.cn/2009/video/images/v_mark_star2.gif';
var imgSrc_2 = 'http://www1.pconline.com.cn/2009/video/images/v_mark_star1.gif';
//---------------------------------------------------------------------------
if (obj.rateFlag) return;
var e = oEvent || window.event;
var target = e.target || e.srcElement;
var imgArray = obj.getElementsByTagName("img");
var markTxt = new Array("太烂了","不值得一看","不合格","不喜欢","还行,过得去","有看头","相信能更好一点",
"很好,多数人会喜欢!","很好,大部分人会喜欢!","值得推荐,棒极了!");
for (var i = 0; i < imgArray.length; i++) {
imgArray[i]._num = i;
imgArray[i].onclick = function() {
if (obj.rateFlag) return;
obj.rateFlag = true;
submitScore((this._num + 1) * 10);
document.getElementById("myScore").innerHTML = (this._num + 1) * 10;
};
}
if (target.tagName == "IMG") {
for (var j = 0; j < imgArray.length; j++) {
if (j <= target._num) {
imgArray[j].src = imgSrc_2;
var mark = (j + 1) * 10;
document.getElementById("vStarMark").innerHTML = "" + mark + "分";
var markTips = document.getElementById("markTip");
markTips.style.display = "block";
markTips.style.left = (j + 1) * 18 - 24 + "px";
markTips.innerHTML = "" + markTxt[j] + "<\/div>";
} else {
imgArray[j].src = imgSrc;
}
}
} else {
for (var k = 0; k < imgArray.length; k++) {
imgArray[k].src = imgSrc;
document.getElementById("vStarMark").innerHTML = "";
document.getElementById("markTip").style.display = "none";
}
}
}
function submitScore(score){
var script = document.createElement("script");
script.setAttribute('src',"//pconline.pcvideo.com.cn/interface/pconline/video_voter.jsp?id=8962&score="+score);
document.body.appendChild(script);
var avgScore = parseFloat(document.getElementById('avgScoreSpan').innerHTML);
var scoreCount = parseInt(document.getElementById('scoreCountSpan').innerHTML);
var pattern = 1;
document.getElementById('avgScoreSpan').innerHTML = (parseInt(((avgScore * scoreCount + parseInt(score)) * pattern) / (scoreCount + 1)) / pattern);
document.getElementById('scoreCountSpan').innerHTML = (scoreCount + 1);
}
//