问题描述
<scripttype="text/javascript">$.fn.studyplay_star=function(options,callback){//默认设置varsettings={MaxStar:20,StarWidth:23,CurrentStar:5,Enabled:true};if(options){jQuery.extend(settings,options);};varcontainer=jQuery(this);container.css({"position":"relative"}).html('<ulclass="studyplay_starBg"></ul>').find('.studyplay_starBg').width(settings.MaxStar*settings.StarWidth).html('<liclass="studyplay_starovering"style="width:'+settings.CurrentStar*settings.StarWidth+'px;z-index:0;"id="studyplay_current"></li>');if(settings.Enabled){varListArray="";for(k=1;k<settings.MaxStar+1;k++){ListArray+='<liclass="studyplay_starON"style="width:'+settings.StarWidth*k+'px;z-index:'+(settings.MaxStar-k+1)+';"></li>';}container.find('.studyplay_starBg').append(ListArray)container.find('.studyplay_starON').hover(function(){$(this).removeClass('studyplay_starON').addClass("studyplay_starovering");$("#studyplay_current").hide();},function(){$(this).removeClass('studyplay_starovering').addClass("studyplay_starON");$("#studyplay_current").show();}).click(function(){varstudyplay_count=settings.MaxStar-$(this).css("z-index")+1;$("#studyplay_current").width(studyplay_count*settings.StarWidth)//回调函数if(typeofcallback=='function'){callback(studyplay_count);return;}})}}</script><scripttype="text/javascript">$(document).ready(function(){$("#z").studyplay_star({MaxStar:10,CurrentStar:2,Enabled:true},function(value){vara=value;alert("您对该路线的评价为:"+a+"分!谢谢参与!")});});</script><p> </p><p> </p><p> </p><p>您的评价为:</p><divid="z"></div></div>代码是网上拿来用的,可是现在它只是弹窗告诉我,我需要获取选中的分数放到label里,然后再插入数据库
解决方案
解决方案二:
....你直接ajax到一个ashx文件。插入数据就可以了
解决方案三:
$("#z").studyplay_star({MaxStar:10,CurrentStar:2,Enabled:true},function(value){vara=value;//alert("您对该路线的评价为:"+a+"分!谢谢参与!")#.ajax({url:"你的网页",data:"Score="+a,success:function(){$("#你label的ID").html(a);alert("您对该路线的评价为:"+a+"分!谢谢参与!")}})//这个是你应该好好看看资料});