Web, by FreeFoto.com   Web Page Authoring
 |Sofia Home | Content Gallery |
Home
Syllabus
Schedule
Lessons
Assignments
Exams

Lesson 18 - Forms, Part 3

Images as Submit & Reset Buttons

Are you tired of forms? Surely not. They're so much fun!

For even more fun, you will turn your Submit and Reset buttons into images.

You will use the <button> tag to set up the image:

  • Open the <button> tag with the following attributes:
    • type="submit"
    • value="submit"
    • name="submit"
  • Then, put in the image:
    • img alt="Submit Button " border="1" src="fly.gif"
  • Finally, close the </button> tag.

Here's what the code will look like:

<button type="submit" name="submit" value="submit">
<img alt="Submit Button" border="1" src="fly.gif" align="center">
</button>

The code for the Reset button will look the same, except that all the Submits will be changed to Reset:

<button type="reset" name="reset" value="reset"><img alt="Reset Button" border="1" src="burn.gif" align="center"></button>

And, here's what the buttons will look like on the page:

Submit & Reset button as image

Some of your readers might not understand that the winged letter means to Submit, and the document on fire means to Reset. So, add labels to those buttons. The addition to the above code is in dark gray.

<button type="submit" name="submit" value="submit"> Send this<br>information<br><img alt="Submit Button" border="1" src="fly.gif" align="center"></button>

<button type="reset" name="reset" value="reset"> Burn this and<br>start over<br><img alt="Reset Button" border="1" src="burn.gif" align="center"></button>

Notice that there are several line breaks <br> to keep the labels on short lines, and to keep the text on a separate line from the image.

Here's what the page looks like now:

Submit & Reset button as image, with Text

Back to Top

Subdivided Drop-Down Menus

Here's another bit you can do with your forms. Remember those drop-down option lists you created in Lesson 17? You can extend those with more than one type of option.

For example, If you want to find out what type of forest students want to study, your list would include:

  1. Hard woods:
    1. Mahogany
    2. Teak
    3. Tropical Cherry
  2. Soft woods:
    1. Pine
    2. Fir

In addition to the Select button, you'll use a couple of optgroup sets.

<p>Which type of tropical forest would you like to study?
<select name="forest">
<optgroup label="hardwood">
<option value="Mahogony">Mahogany <option value="Teak">Teak
<option value="TropicalCherry">Tropical Cherry
</optgroup>
<optgroup label="softwood">
<option value="Pine">Pine
<option value="Fir">Fir
</optgroup>
</select>
</p>
First, ask your question.

Name the <select> tag "forest". Remember, this is the label that will come back on your email message.

Next, open your first group - hardwood, then list each of the options and close this group.

Then, open the second group - softwood, list each option and close this group.

Finally, close the </select> tag.

Here's what it will look like on the webpage if you use Internet Explorer:

Example of sub-divided drop-down Menu in IE

Most other browsers will present it as one long list with indents for each optgroup:

Example of sub-divided drop-down Menu in browsers other than IE

Back to Top

Password Boxes

The only difference between a password box and a text box is that whatever is typed into a password box is hidden by bullets or asterisks. The person sitting next to my reader in the library can't see what she's typing. But the information is NOT encrypted in any manner when it is sent to the server.

<p>What is your secret name?
<input type="password" name="secret" size="35">
</p>

You will use the same <input> tag, but the type changes to password. The line that changes is in dark gray.

Set the name (the label that comes back to your email) to "secret", and the size of the box to "35" characters.

Now, when somebody answers your question, the typing will appear like this:

Example of form with Password

Back to Top

Final Project

You are now over half way through this course and closer to the final project, described in Lesson 22.

The following two items will be covered in the next lessons:

  1. Include an address block at the bottom of each page.
  2. Include metatags for content keywords and descriptions.
But, by now you should be able to look at the Final Project requirements and know how to fulfill all of them.

This is the end of Lesson 18. Please go to the next lesson.

 

Back to Top
Content Developed by Jo Anne Howell, Licensed under a Creative Commons License
Published by the Sofia Open Content Initiative
© 2004 Foothill-De Anza Community College District &The William and Flora Hewlett Foundation