Page 1 of 1

My Ratings Don't Work

PostPosted: November 16th, 2017, 8:39 pm
by MK_Wizard
Hello

At first, it was just a suspicion, but now someone has confirmed that the ratings button on my comic doesn't work. It only refreshes. Is this a bug or a problem with my code? If it is a problem with my code, can you please provide me with one that works instead of just refreshing the page?

Thanks!

Re: My Ratings Don't Work

PostPosted: November 16th, 2017, 10:32 pm
by Campion
Your page is calling a function that doesn't exist in your CSS.

Put this somewhere on your comic page (preferably up near the top):

Code: Select all
<script language="JavaScript">



var dir = "http://www.smackjeeves.com/templates/default/images/";

var pic_unselected = "star-unselected.gif";

var pic_selected = "star-selected.gif";



// "Buffers" the image to the browser

document.write('<img style="display: none" src="' + dir + pic_unselected + '" />');

document.write('<img style="display: none" src="' + dir + pic_selected + '" />');



<!-- BEGIN switch_user_has_voted -->

var default_rating = {switch_user_has_voted.RATING};

<!-- END switch_user_has_voted -->

<!-- BEGIN switch_user_hasnt_voted -->

var default_rating = 0;

<!-- END switch_user_hasnt_voted -->



function build_vote()

{

   document.write('<b>Rate this Comic:</b> ');

   for (n = 1; n<= 5; n++)

   {

      if (n <= default_rating)

      {

         default_pic = pic_selected;

      } else {

         default_pic = pic_unselected;

      }



      document.write('<a href="#" onClick="vote(' + n + '); return false;" onMouseOver="rateover(' + n + ');" onMouseOut="rateover(default_rating);"><img src="' + dir + default_pic + '" name="star_' + n + '" border=0></a> ');

   }

   document.write('</ul>');

}



function rateover(star_num)

{

   

   for (n = 1; n <= 5; n++)

   {

      if (n <= star_num)

      {

         da_code = 'document.star_' + n + '.src="' + dir + pic_selected + '"';

      } else {

         da_code = 'document.star_' + n + '.src="' + dir + pic_unselected + '"';

      }

     

      eval(da_code);

   }

}



function vote(rating)

{

   var new_window = window.open("/ratecomic.php?cid={COMIC_ID}&rating=" + rating, "sj_ratecomic", "height=300, width=400");

   new_window.focus();

}



</script>


Re: My Ratings Don't Work

PostPosted: November 17th, 2017, 9:09 am
by MK_Wizard
Thanks a lot, Campion!