Exercises: Extended Widgets
Test all exercises in development mode.
1.
Make a button that, when pressed, pops up a dialog box that contains
<h1>Wow! Button was pressed!</h1>
2.
Copy the code for one of the examples from your last set of exercises that used
tabbed panels. Change it to use stacked panels (aka accordion panels) instead.
3.
Make a date-input field and a button. When the button is pressed, take the date that
the user entered, look up the year, and insert that into the page.
4.
Make a Java array that contains a few city names beginning with A and B. (See
http://www.airportcodes.org/ for a list.) Make an auto-completing text box that lets
the user choose a city name. For bonus credit, send the city name to Google when
the user presses a button.
5.
Make a menu bar where the top-level entries are M, N, and O. When you click
on an entry, you should get a list of the US states starting with that letter. Here are the
states:
M: Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri,
Montana
N: Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York,
North Carolina, North Dakota
O: Ohio, Oklahoma, Oregon
Try the simple case first, where clicking on the letter shows the list of states, and
clicking on a state pops up an alert (Window.alert) simply saying A state was
selected. If you feel inspired, change it to now show which state was selected.
http://www.coreservlets.com