title: JavaScript Rating after refreshpage
body: <p>I have a java script functions to display rating..
  When user click on stars to rate I need to display the Thank you for rating message and when user refresh the page I need to display thank you for rating message instead of Rate this article.
      Below is my code: could any one help me out?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  
  var sMax;   // Isthe maximum number of stars
  var holder; // Is the holding pattern for clicked state
  var preSet; // Is the PreSet value onces a selection has been made
  var rated;
  
  // Rollover for image Stars //
  
  
  
  function rating(num){
      sMax = 0;   // Isthe maximum number of stars
      for(n=0; n&lt;num.parentNode.childNodes.length; n++){
          if(num.parentNode.childNodes[n].nodeName == "A"){
              sMax++; 
          }
      }
  
      if(!rated){
          s = num.id.replace("_", ''); // Get the selected star
          a = 0;
          for(i=1; i&lt;=sMax; i++){     
              if(i&lt;=s){
                  document.getElementById("_"+i).className = "on";
                  document.getElementById("rateStatus").innerHTML = num.title;    
                  holder = a+1;
                  a++;
              }else{
                  document.getElementById("_"+i).className = "";
              }
          }
      }
  }
  
  // For when you roll out of the the whole thing //
  function off(me){
      if(!rated){
          if(!preSet){    
              for(i=1; i&lt;=sMax; i++){     
                  document.getElementById("_"+i).className = "";
                  document.getElementById("rateStatus").innerHTML = me.parentNode.title;
              }
          }else{
              rating(preSet);
              document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML;
          }
      }
  }
  
  // When you actually rate something //
  function rateIt(me){
      if(!rated){
          document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML + " :: "+me.title;
          preSet = me;
          rated=1;
          sendRate(me);
          rating(me);
      }
  }
  
  // Send the rating information somewhere using Ajax or something like that.
  function sendRate(sel){
      alert("Your rating was: "+sel.title);
  }
  
  
  &lt;/script&gt;
  
  
  
  
  
  &lt;form id="form1"&gt;
  
  
  &lt;span id="rateStatus"&gt;Rate This Article:&lt;/span&gt;
  &lt;span id="ratingSaved"&gt;Thank you for rating.&lt;/span&gt; 
  &lt;div id="rateMe" title="Rate Me..."&gt;
      &lt;a onclick="rateIt(this)" id="_1" title="ehh..." onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;/a&gt;
      &lt;a onclick="rateIt(this)" id="_2" title="Not Bad" onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;/a&gt;
      &lt;a onclick="rateIt(this)" id="_3" title="Pretty Good" onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>