This onclick function:
VVi".$row['id'].".onclick = function() {
alert('1');
var ResultI = '".$row['id']."';
location.href='visuals.php?ResultI=' + ResultI + '&pg=' + pgi + '&vid=false';
};
Cannot be called on firefox… I tried it on chrome and opera, and everything worked fine… So how can i call the function that everything would work fine on all browsers. I need similar method, because i dont want related codes to get effect… Thanks
Edit:
Firefox result:
<a class='menuLink' id='VVi19'>
<div id='IIi19' style='width: 230px;
height: 136px;
background: url(res/images/images.jpg);
background-size: contain;
background-repeat: no-repeat;
background-position:center;'></div>
</a>
</td>
<script type='text/javascript'>
VVi19.onclick = function() {
alert('1');
var ResultI = '19';
location.href='visuals.php?ResultI=' + ResultI + '&pg=' + pgi + '&vid=false';
};
</script>
A function declared as a closure as you have done there is an assignment statement and as such must be terminated with a semi-colon
;.Some ECMAScript engines are more forgiving than others about this – try adding the semi-colon, like so:
Edit after inspecting the whole code it would seem that the problem is that your tag order is all messed up, and that is why it is not working. Amongst other things, a
<script>element is not valid as a direct child of a<table>, and a<td>should be enclosed in a<tr>. You also assign a staticid=in a loop, which result in duplicated element IDs, and you seem to be referencing HTML elements using an object named with their ID, without assigning the element to the object.Try changing:
To:
…although even if this does fix your immediate problem, you will likely find other stuff that doesn’t work. You need to pass all you generated pages through the W3C markup validation service and you should also see what JSLint has to say about your Javascript.