I am taking session attribute in my javascript and then using it in if-else.
The script is suppose to run whenever user some anchor tags click on anchor tag.

```
<a id="someId" href="/someurl" onClick="checkSession(this.id)">Link</a>

<a id="someOtherId" href="/someurl" onClick="checkSession(this.id)">Link2</a>

```

And within body

```
<script type="text/javascript">

    function checkSomething(clickedId){     

        event.preventDefault();     
        var value= <%=(int) session.getAttribute("key")%>;

        if(value != -1){
            window.location = $('#'+clickedId).attr('href');
        }else {
            alert("Please Select a value first then click on the link.");
            $("#someInput").focus();
        }

    };

</script>

```

Script runs perfectly on chrome but fails on mozilla and IE.
On mozilla I can see that anchor tags has been bind with that javascript but yet it does not run.