I have very simple html and javascript.
<html> <body> <h1>Test function</h1> <p>Hello</p> <script> function goodbye() { document.write ("good bye"); } goodbye(); </script> </body> </html>
The result displays the string Hello and good bye. I moved the farewell function to my "goodbye.js" file. So my first html now looks like
<html> <body> <h1>Test function</h1> <p>Hello</p> <script src='goodbye.js'> goodbye(); </script> </body> </html>
Now, if I run html again, it will only display Hello. I did not expect this. What happened?
source share