'Image onclick event for calling function is not working for Firefox and Chrome
I have a div section in which I have an image whose onclick event should execute a function called in it, but it is not executable in Firefox or Chrome with my code, infact the image is not clickable at all . Could some one help me in get the thing done? Below is the code I am working with:
<div class="addtocart-popup-bg">
<div class="addtocart-popup-link">
<ul>
<li class="col1"><img src="images/categorypage/folder-icon.gif" width="62" height="50" border="0" /></li>
<li class="col2">
Submit Print Ready File
<p>Upload your ready to print file/artwork.</p>
</li>
<li class="col3"><img src="images/categorypage/start-order-now-btn.gif" width="134" height="29" border="0" title="Start Order Now" alt="Start Order Now" style="cursor:pointer" onclick="<?php echo "javascript:gotoCat('1');" ?>"/></li>
</ul>
</div>
</div>
Solution 1:[1]
I tested your code on Firefox 3.6.10/Ubuntu 9.10, after prepending
<html>
<head>
<title>Test onClick()</title>
<script type="text/javascript">
function gotoCat(n) { alert("gotoCat(" + n + ")"); }
</script>
<body>
and appending </body>.
It works as intended.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Edgar Bonet |
