In this lab, you will work with the JavaScript window and document objects.
Use File - Close All to close all open editing windows.
In RAD, create a new Dynamic Web Project named Lab15Web associated with Lab15EAR.
In the WebContent folder, create a new HTML File, countdown.html, that contains a form with a submit button and a <div> or <p>. When the user clicks the button:
When the timer fires:
Hint: To enable/disable the button, set its disabled property to true or false:
document.getElementById("submit").disabled = true;
Create a new HTML File, myurl.html with a JavaScript that displays the page's URL in a <div> or <p>.
Hint: Put your code inside of a function that runs during the window.onload event.
Create a new HTML File, target.html. Put something interesting within its body.
Create another HTML File, navigate.html. The file should contain a form with a submit button. When the user clicks the submit button, change the browser's URL to target.html.
Create a new HTML file, showbrowserinfo.html, that writes the appName, appVersion, userAgent, platform, availWidth and availHeight strings to separate div elements on the page.
Create a new HTML file, showsecondary.html with a form. When the user submits the form, open target.html in another browser window using all defaults.
After you get that to work, modify the code so opens target.html in yet another window with width="300" and height="200".
Create a new HTML File, testdom.html. Here are the specs:
In the body, write a <p> element that contains strong, emphasized, and both strong and emphasized text using the <strong> and <em> tags.
Write a form with two input widgets of type button (not submit). Attach onclick handlers to each that invoke different JavaScript functions.
Write two <div> elements with unique IDs to which your scripts will write.
Write the first Javascript function referenced by one of the onclick handlers:
Write the second Javascript function referenced by the other onclick handler:
Run and test and ensure that you understand the behavior and the difference between innerHTML and innerText.
Create a new HTML file, dynamic-add-delete.html with a form that has two buttons (not submit buttons): one labeled "Add", the other "Remove". The page should also have an empty unordered list using the <ul> element.
When the user clicks the "Add" button, add a new <li> element with text of your choice to the <ul>.
When the user clicks the "Remove" button, remove the last <li>.
For extra credit, the list items should contain a number, e.g. "list item #1", "list item #2" and that number should reflect the item's position in the list.
Create a new HTML page, rentcar.html. This page should have a form with the following:
Write JavaScript so that if the user puts a checkmark in the different-location checkbox, the form also displays a text input widget with label "Return city:". If the user unchecks the box, remove the new text input and label.