开发者

Image onclick event for calling function is not working for Firefox and Chrome

开发者 https://www.devze.com 2023-01-18 06:01 出处:网络
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

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 N开发者_Python百科ow" style="cursor:pointer" onclick="<?php echo "javascript:gotoCat('1');" ?>"/></li>
</ul>
</div>
</div>


You wrote that the image is not clickable. Did you mean, that the assigned cursor did not appear?

In that case I think it's a problem of CSS, there seems to be something hidden in front of the image.
You can use firebug as well to find out what it is.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消