The script in script.js will cause an the alert, but doesn't when I write it into the index file, the second alert works
rel="stylesheet"> <script src="js/script.js"></script> <script> alert("Another message from inside index.html") </script>
Bob Swaney11,848 Points
hello. what do you mean that it doesn't cause the alert when you write it into the index file? If you load up the HTML page and the .js file is causing the alert and the second alert is working, isn't that what you are looking for? if the alert from the .js file is firing, then you have it linked up to the HTML correctly.
hello, does it work when in the html or when it is in the js file? may be you did not link up properly? take screenshot of the whole screen so we can have a look.
Stijn Vanthournout687 Points
I also only get the second alert "another message" to work. The first one doesnt run.