HTML + CSS + Javascript
Javascript:
<!DOCTYPE html> <html> <head> <script> alert('hello world'); </script> </head> <body> </body> </html>
Sample file: 01_hello.html
alert('hello world'); // Opens alert box with message document.write('<p> Hellow World Again! </p>'); // write text into the html document
Including an external javascript file on your server
<!DOCTYPE html> <html> <head> <script src="myscript.js"> </script> // external file </head> <body> </body> </html>
Including an external javascript file from another server
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="myscript.js"> </script> <script> alert('hello world'); </script> </head> <body> </body> </html>
Sample file: 01_external.html
<!DOCTYPE html> <html> <head> <title> The Title of this HTML Page </title> <script src="http://code.jquery.com/jquery-3.2.1.min.js"></script> <script> $(document).ready(function() { $('body').hide().fadeIn(3000); }); </script> </head> <body> Hello. This is the body. </body> </html>
The use of Javascript console is a must. Before asking anyone else why your javascript does not work, make sure you check the console.
On Chrome:View -> Developer -> JavaScript Console
It can be cryptic at first but it is helpful in