Question : Problem in IE when mixing embedded and external javascript in a JSP

I have a sample JSP code that mixes embedded and external javascript. The code works in Chrome but does not work in IE. The code works if I comment out the extenal javascript and leave only the embedded. Any idea how to achieve this in IE? I am trying to avoid putting all page-specific javascript in one humongous file that needs to be imported to all pages.

<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<html>
<head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <script language="javascript" type="text/javascript" src="test.js"/>
    <script language="javascript" type="text/javascript">
        function doSth() {
                    alert("hello");
        }
    </script>

</head>
<body onload="doSth()">
</body>
</html>

---- and test.js:
function isNull(component) {
    //    alert("isNull");
    if (document.getElementById(component).value == "") {
        return true;
    }
    return false;
}

Answer : Problem in IE when mixing embedded and external javascript in a JSP

Try this.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<html>
<head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <script  type="text/javascript" src="test.js">
    </script>
    <script  type="text/javascript">
        function doSth() {
                    alert("hello");
        }
    </script>
</head>
<body onload="doSth();">
</body>
</html>
Random Solutions  
 
programming4us programming4us