Ajax Up/Down Voting Script

Simple Ajax Up/Down Voting Script that allows users to vote an item in a webpage. The easiest way for voting anything on your web site. Allow users to click on the up and down arrows to vote the events.


  • Free Script for websites where users could vote if they "Like" or "Don't Like" the events.
  • Easy customization - change colors, fonts and styles using CSS.
  • No database is required as results are stored in file.
  • Voting script that supports almost all browsers.


Ajax Up/Down Voting Script


Copy and Paste the script to make it use in your webpage.

Javascript Code

<!-- Script by hscripts.com -->
<!-- More scripts @www.hscripts.com -->
<script type="text/javascript">
var httpa;
var browser = navigator.appName;
function createRequestObject()
var request_o; //declare the variable to hold the object.
if(browser == "Microsoft Internet Explorer")
/* Create the object using MSIE's method */
request_o = new ActiveXObject("Microsoft.XMLHTTP");
/* Create the object using other browser's method */
request_o = new XMLHttpRequest();
return request_o; //return the object


function setrating(val,id)

httpa = createRequestObject();
var str="addrating.php?id="+id+"&value="+val;
httpa.open('get', str);
httpa.onreadystatechange = handleResponse;


function handleResponse()
if(httpa.readyState == 4)
var response = httpa.responseText;




<!-- Script by hscripts.com -->


<table style='border:1px solid green;' cellspacing=0 cellpadding=0>
<input id=prc name=prc type=text size=6 value=1 readonly style='background-color: white; border:0px;'>

<img border=0 src="hupanddown/uarrow.gif" onclick="setrating(document.getElementById('prc').value,'uarrow');">

<img border=0 src="hupanddown/darrow.gif" onclick="setrating(document.getElementById('prc').value,'darrow');">


<div align=center style='font-size: 10px; color: #dadada;' id="dumdiv">

<a href="//www.hscripts.com" id="dum" style='text-decoration:none; color: #dadada;'>&copy; hscripts.com</a>


  • Download and unzip the Up/Down Voting Script.
  • Copy and paste the javascript code into your HTML page and make use of this Like and Don't Like script.
  • Here, the function "setrating()" is used to increase and decrease the voting value using ajax.
  • Easy to setup and customise.


Related Scripts

Ask Questions

Ask Question