Javascript
Your first Hello World! JavaScript application | Your first Hello World! JavaScript application |
|
It would be interesting to make the page a little more dynamic. Both of the major browsers, Netscape Navigator and Microsoft Internet Explorer, support JavaScript, a scripting language that is perfect for adding interactive features to a Web page. Take a look at the following snippet of code: alert("hello world"); </script> Here's an example where dynamic variables are used. <html> <h1>Hello, John</h1> <script> //Hello John var greeting; greeting = "Hi there, John"; alert(greeting); </script> If you would like to prompt the user for their name, here's the code to greet them by their name. <html> <head> <title>Hello User</title> </head> <body> <h1>Hello, User Name</h1> <script> //hello user - Ask user for name var userName; userName = prompt("What is your name?"); alert(userName); </script> </body> </html> |
