I have the following HTML and Javascript in a page that should display "TEXT" in the body and alert me with "alert!" However, it only displays "TEXT"; my Javascript console says "msg is undefined."
<html>
<head>
<script type="test/javascript">
function msg() {
alert("alert!");
}
</script>
</head>
<body>
<p>
<script type="text/javascript">
document.write('TEXT');
msg();
</script>
</p>
</body>
</html>