I am trying to refer a external javascript file by calling a function in that file as
<script type="text/javascript" src="external.js">
display('hell0');
</script>
But this code is not working. If i refer the file in separdate script tag it works fine.
<script type="text/javascript" src="external.js"></script>
<script type="text/javascript">
display('hell0');
</script>
Why the first case is not working?
If you use the
srcattribute to specify an external javascript file to be included you cannot have contents to thisscripttag. The second case is the correct way.Quote from the specification: