How to include external javascript functions -


i trying refer external javascript file calling function in file

<script type="text/javascript" src="external.js"> display('hell0'); </script> 

but code not working. if refer file in separdate script tag works fine.

    <script type="text/javascript" src="external.js"></script>    <script type="text/javascript">       display('hell0');     </script> 

why first case not working?

if use src attribute specify external javascript file included cannot have contents script tag. second case correct way.

quote specification:

the script may defined within contents of script element or in external file. if src attribute not set, user agents must interpret contents of element script. if src has uri value, user agents must ignore element's contents , retrieve script via uri


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -