views:

107

answers:

2

All the other browsers operate just fine with this, but firefox says 'share is not a function'.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

    <script type="text/javascript">
    function share(){
        var url = "http://www.facebook.com/sharer.php?u=http://google.com";
        var win = window.open(url, "share", "status = 1, height = 500, width = 600, resizable = 0" );
        var pollTimer = window.setInterval(function() {
            if (win.closed) {
                window.clearInterval(pollTimer);
                window.location = "http://gmail.com";
            }
        }, 200);

    }
    </script>

</head>

<body>

<div id="sharebox">
    <img id="share" src="img/share.png" onclick="share();" />
</div>

</body>
</html>
+1  A: 

Without more information this will be impossible to solve, but you may find that the javascript file this function is in had an error, so the parsing stops, then this function also wouldn't be parsed if it is after the part with an error.

Some browsers are more forgiving than others are on errors.

If you use JSLint (http://jslint.com/) to fix the errors that it reports, it may fix your problem.

Otherwise try to use the firebug extension to see where the error may be.

James Black
+2  A: 

I found the problem. You are not allowed an object with the same id as a function name. I never knew that :s

Pablo
the Id of the image is same as the function name. that's why it is not working, it is nice to know about it in firefox.
Kronass