I am trying the below code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Demo</title>
</head>
<body>
hi
<script src="abcs.js">
function func_try()
{alert("checking");
}
</script>function fun
<script>
c_onload(){
alert("welcome to JS world");
func_try();
}
</script>
<script>
window.onload= func_onload();
</script>
</body>
</html >
Here abcs.js is an empty file present in the same location of this html.
On execution alert("welcome to JS world"); works but alert("checking"); doesn't work.
Is this because of the src of javascript included as abcs.js. If yes then whats the reason?
i have never seen/tried it. But what's the big deal, just put the body script in another <script> tags and go ahead, just likeits donr in the second <script> tag of your code.
-Abhishek
I came to this world on a Learner's License