The javascript function does not work in IE and Firefox

advertisements

I have a function written in javascript as follows,

<script>
function newPopup(url) {
        popupWindow = window.open(url,'popUpWindow','height=700,width=1300,left=480,top=190,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes').focus();
}
</script>

And Its called like this within the href of a button

document.getElementById('user-help').href = 'Javascript:newPopup("<spring:message code="user.help.dashboard"></spring:message>")';

This works in Chrome and Opera. But doesn't work in IE and Firefox.In firefox just a blank page appears while in IE error called page cannot be displayed. Can someone please give me a solution for this. I have searched, but did not find a favorable solution.


Try this,

    <script>
    function newPopup(url) {
         var popupWindow = window.open(url,'popUpWindow','height=700,width=1300,left=480,top=190,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes');
         popupWindow.focus();
    }
    </script>

And call like this,

document.getElementById('user-help').href = 'Javascript:newPopup("<spring:message code=\"user.help.dashboard\"></spring:message>")';

Hope it works for you, thank you.