Docsity

Beginning JavaScript - General Applications Program | CSCE 102, Lab Reports of Computer Science

Toggle sidebar
bg1
Lab 9
Beginning JavaScript
CSCE 102
In this lab, you will create lab9xx.html. You will need to include links to this page on
myhomepage.html page in the list. If your myhomepage.html is not up to date (including the
image map and an up-to–date list) correct it before this lab is due. You will get a grade on
your myhomepage.html page this week. Read the entire assignment before you start.
The work you turn in is to be your work, not copied from someone else or from the
web.
Never allow anyone access to your files
Never give anyone your password.
Never share your USB memory, etc.
Never give anyone a printed copy of your file.
Never allow anyone to copy your work.
Alerts/Prompts/Assignment Statements ─ lab9xx.html:
Include an appropriate title that includes today’s date.
Specify a background color and text color using an internal style sheet.
Within a script element in the head, create an alert. You choose what it says.
Include your name, section number, and today’s date in an h2 tag.
Use the onclick event handler as an attribute of the h2 tag with the attribute value
being an alert that pops up when the h2 element is clicked. You make up the content
of the alert box. Note: JavaScript can occur in two places, within a script element
and after an event handler.
Include three or four of sentences about your favorite food in a paragraph.
In that paragraph tag use the onclick event handler as an attribute with the attribute
value being an alert that pops up when the p element is clicked. You make up the
content of the alert box.
Within a script element in the body, prompt the user for his name and use
document.write to write that name in h3 format on the page. Hint: Declare the
variable although the declaration is not required in JavaScript; use an assignment
statement with a prompt to give the variable a value. Note: For document.write see
pg. 230.
Within the same script element, using the document.body.style.color and
document.body.style.backgroundColor properties and assignment statements change
the color of the background and text on your page. Note: This will not work if it is
placed in the head; the body will not have loaded yet. We never use fgcolor or
bgcolor because we are using CSS.
After the alert boxes above, inside of the same script element, use the
document.body.style.color and document.body.style.backgroundColor properties to
change the text and background color of your document to a color different from the
colors you specified earlier. Hint: Use assignment statements.
Print both lab9xx.html and myhomepage.html

Partial preview of the text

Download Beginning JavaScript - General Applications Program | CSCE 102 and more Lab Reports Computer Science in PDF only on Docsity!

Lab 9

Beginning JavaScript

CSCE 102

In this lab, you will create l ab9xx.html. You will need to include links to this page on myhomepage.html page in the list. If your myhomepage.html is not up to date (including the image map and an up-to–date list) correct it before this lab is due. You will get a grade on your myhomepage.html page this week. Read the entire assignment before you start.  The work you turn in is to be your work, not copied from someone else or from the web.Never allow anyone access to your filesNever give anyone your password.Never share your USB memory, etc.Never give anyone a printed copy of your file.Never allow anyone to copy your work.

Alerts/Prompts/Assignment Statements ─ lab9xx.html :

 Include an appropriate title that includes today’s date.  Specify a background color and text color using an internal style sheet.  Within a script element in the head, create an alert. You choose what it says.  Include your name, section number, and today’s date in an h2 tag.  Use the onclick event handler as an attribute of the h2 tag with the attribute value being an alert that pops up when the h2 element is clicked. You make up the content of the alert box. Note : JavaScript can occur in two places, within a script element and after an event handler.  Include three or four of sentences about your favorite food in a paragraph.  In that paragraph tag use the onclick event handler as an attribute with the attribute value being an alert that pops up when the p element is clicked. You make up the content of the alert box.  Within a script element in the body , prompt the user for his name and use document.write to write that name in h3 format on the page. Hint : Declare the variable although the declaration is not required in JavaScript; use an assignment statement with a prompt to give the variable a value. Note : For document.write see pg. 230.  Within the same script element, using the document.body.style.color and document.body.style.backgroundColor properties and assignment statements change the color of the background and text on your page. Note : This will not work if it is placed in the head; the body will not have loaded yet. We never use fgcolor or bgcolor because we are using CSS.  After the alert boxes above, inside of the same script element, use the document.body.style.color and document.body.style.backgroundColor properties to change the text and background color of your document to a color different from the colors you specified earlier. Hint : Use assignment statements.  Print both lab9xx.html and myhomepage.html