2010-01-07 57 views
0

现在如果没有投票,我的评级脚本将无法在Internet Explorer中工作我无法点击明星并将其值输入数据库并显示在浏览器中。JQuery Rating Internet Explorer问题

但是,如果已经投了一票,脚本将在Internet Explorer中完美工作。

我该如何解决这个问题,以便如果没有投票,那么Internet Explorer用户可以首先输入投票?

我认为我的JQuery代码给了我这个问题,所以我会显示这个和我的HTML标记。

我使用PHP,JQuery和MySQL。

jQuery代码

// JavaScript Document 
    $(document).ready(function() { 

     // get average rating 
     getRatingText(); 
     // get average rating function 
     function getRatingText(){ 
      $.ajax({ 
       type: "GET", 
       url: "update.php", 
       data: "do=getavgrate", 
       cache: false, 
       async: false, 
       success: function(result) { 
        // add rating text 
        $("#rating-text").text(result); 
       }, 
       error: function(result) { 
        alert("some error occured, please try again later"); 
       } 
      }); 
     } 

     // get current rating 
     getRating(); 
     // get rating function 
     function getRating(){ 
      $.ajax({ 
       type: "GET", 
       url: "update.php", 
       data: "do=getrate", 
       cache: false, 
       async: false, 
       success: function(result) { 
        // apply star rating to element dynamically 
        $("#current-rating").css({ width: "" + result + "%" }); 
        // add rating text dynamically 
        $("#rating-text").text(getRatingText()); 
       }, 
       error: function(result) { 
        alert("some error occured, please try again later"); 
       } 
      }); 
     } 


     // link handler 
     $('#ratelinks li a').click(function(){ 
      $.ajax({ 
       type: "GET", 
       url: "update.php", 
       data: "rating="+$(this).text()+"&do=rate", 
       cache: false, 
       async: false, 
       success: function(result) { 
        // remove #ratelinks element to prevent another rate 
        $("#ratelinks").remove(); 
        // get rating after click 
        getRating(); 
       }, 
       error: function(result) { 
        alert("some error occured, please try again later"); 
       } 
      }); 

     }); 
    }); 

HTML标记

<ul class='star-rating'> 
    <li class="current-rating" id="current-rating"><!-- will show current rating --></li> 
    <li id="ratelinks"> 
     <ul> 
       <li><a href="javascript:void(0)" title="1 star out of 10" class="one-star">1</a></li> 
       <li><a href="javascript:void(0)" title="2 stars out of 10" class="two-stars">2</a></li> 
       <li><a href="javascript:void(0)" title="3 stars out of 10" class="three-stars">3</a></li> 
       <li><a href="javascript:void(0)" title="4 stars out of 10" class="four-stars">4</a></li> 
       <li><a href="javascript:void(0)" title="5 stars out of 10" class="five-stars">5</a></li> 
       <li><a href="javascript:void(0)" title="6 stars out of 10" class="six-star">6</a></li> 
       <li><a href="javascript:void(0)" title="7 stars out of 10" class="seven-stars">7</a></li> 
       <li><a href="javascript:void(0)" title="8 stars out of 10" class="eight-stars">8</a></li> 
       <li><a href="javascript:void(0)" title="9 stars out of 10" class="nine-stars">9</a></li> 
       <li><a href="javascript:void(0)" title="10 stars out of 10" class="ten-stars">10</a></li> 
     </ul> 
    </li> 
</ul> 

回答

0

回答我自己的问题,我想它是不是连我的jQuery代码,这是我的PHP代码对不起人。 +1对我来说:)

+0

如果您的解决方案适用于您在此处询问的问题,则应该发布。否则,你应该关闭/删除它。 – 2010-05-04 21:01:52

+0

考虑通过点击旁边的“勾号”或“检查”图标将此答案标记为“接受” – 2012-08-18 07:48:49