The script works just fine in IE, problems occur in FF.
<script language="JavaScript" type="text/javascript">
var counter = 0;
window.onload = ajaxFunction;
function ajaxFunction(nr){
var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
return false;
}
}
}
function feedback(){
if(ajaxRequest.readyState==4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
if(!nr || nr==null){ //problem seems to be somewhere
counter = counter + 3; //in this part, FF doesn't somehow get the value "nr"
} //FF skips that part completely and reads counter = 0
else counter = counter + nr;
var url = "homeproov.php";
var leht = "?counter=" + counter;
ajaxRequest.open("GET", url+leht, true);
ajaxRequest.send(null);
ajaxRequest.onreadystatechange = feedback;
}
</script>
The lower part goes to the <body> section
<div style='float:left;margin-top:25px;'><a href="javascript: void(0)" onclick="ajaxFunction(-3)" ><img src='navimg.png' /></a></div>
<div id='ajaxDiv' style='float:left;'>Results</div>
<div style='float:right;margin-top:25px;'><a href="javascript: void(0)" onclick="ajaxFunction(3)" ><img src='navimg2.png' /></a></div>
PHP code is following:
$show = 3;
$counter = $_GET['counter'];
$max = 'limit '.$counter.','.$show;
$tulemus=mysql_query("SELECT film.nimi,film.aasta,zanr.zanr,zanr.sisestuskp,zanr.cover FROM film,zanr
WHERE film.nimi=zanr.nimi ORDER BY nimi $max") or die(mysql_error());
mysql_error says :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[object Event],3' at line 3
Anybody knows how can i get this to work in FF?:-/