Hi,
can someone explain why this happens

I have two files . trial.html and trial. js
--------------------------------------------------
trial.js


alert("If this executes trial.js is loaded");
function my_function()
{
("hello world");
}

---------------------------------------------------
trial.html

.
.
.
<script src="trail.js">
// alert() WORKS
my_function(); // DOES NOT WORK... the control does not go inside a fucntion

// the file is definitely loaded as the statment alert(); before the function defn executes

</script>



why does this happen. now if i tweak t a bit and put my_function() call in the js file

i.e

trial.js


alert("If this executes trial.js is loaded");
function my_function()
{
("hello world");
}
my_function(); //THIS WORKS ONCE REMOVED FROM the html file
------------------------------------------------------------------------------------
why does this happen