How do I make a JavaScript? Before beginning, you must be able to login to your mason account and you must have a public_html directory. If you already have a public_html directory, do not create another one. (Ask your TA for help if you are unsure or use the Unix command ls to list the contents of your mason account.)
To create a public_html directory:
(login) chmod a+x . (don't forget the spaces and the dot) mkdir public_html (use an underscore, not an hyphen) chmod a+rx public_htmlNow you are ready to try the simple Javascript exercise below:
Important Note: JavaScript is "case sensitive." This means you must be especially careful when typing in JavaScripts.
JavaScript commands go inside <script> </script> tags. These scripts may go in the head or body section of the html document. Note: Click here for help with the pico text editor.
Sample Script
(login) cd public_html pico myscript.html (then enter the file below) <html> <head> <!--Simple Java script written by (your name) on (today's date)--> <title>This is a JavaScript Test</title> </head> <body> <script> document.write("Hello world!") </script> </body> </html> (type control x, save and exit) chmod a+r myscript.html Then go to your web browser and enter this url: http://mason.gmu.edu/~yourloginname/myscript.htmlYour script should appear. If it doesn't ask your TA or instructor for help.
For more information on JavaScript, see
T. Negrino and D. Smith, JavaScript for the World Wide Web, 4th
edition, Peachpit Press, 2001.
Now you are ready to do part II: Cookies.