For today, please make a copy of my file, wantjavascript.html.
You can do this by using File | Save as...
First personalize it by putting your name where it says "(your name here)".
Then add REQUIRED and/or
JavaScript to your copy, sufficient to check that all the form elements are filled
out appropriately. You may of course use my functions.
Put your completed file, still named wantjavascript.html, in your
www/ directory on osiris. You do not need a link in your home
page.
You may use my functions, or do your
own.
ssh osiris cp /home/jensen/wantjavascript.html wwwKeep the name wantjavascript.html so that I may find it easily!
If you set a cookie in your php page, for example, with the name of the person filling out your form, please use it this week in your main page, accessing it using javascript, as below.
Otherwise,
wantjavascript sets the cookie "week11name", onChange to the "Your name" input. (do not change "week11name")
Please access this cookie, using javascript (see using
cookies js, -- copy useful script from there. Also example
on Osiris, cookie.html)
and print it near the
top of your index.html. After filling out the form, you
should see the name that was typed in the form. If the form hasn't
been filled, you won't see anything different on index.html from
before.
Example:
var cook = cookies_array() document.write(cook['week11name']) //requires my function // OR // using regular expression: var m = /week11name\=([^\;]+)/i.exec(document.cookie) if (m) document.write("Welcome back "+m[1]+"<br>")
There is a link to index.html
at the bottom of the form. You can try this even before
you put the other javascript with the form.