This simple onlick event works in IE and Chrome but not in FireFox (latest version). Is there some syntax issue?

<html> 
<head> 
<script>
    function scroll() { 
        alert(1);
    }
</script>
</head> 
<body> 
<a href="#" onclick="javascript:scroll();" />Click Here</a>
</body> 
</html> 

Thanks in advance!

Actually it might be that you closed your a tag twice.

Remove the / at the end of the first part of the a tag.

Also it also seems FF doesn't like "scroll" - try renaming your function to something else.

Bingo - "scroll" must be a reserved word in FF. Thanks for your help.

You're welcome.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.