«§
§»
Unit 10: Forms - A Few Sample Uses
zforms
Forms are the coding used to collect data, and transfer the data to another page.
-
___FORM block ____elements
___METHOD= elements
___ACTION= elements
-
___INPUT statement
___TYPE= element
- ___TEXT argument
- ___SUBMIT argument
- ___IMAGE argument
- ___HIDDEN argument
___NAME= element
___SIZE= element
___SRC= href element
___ALIGN= element
___ALT= element
___WIDTH= element
___HEIGHT= element
___BORDER= element
Coding a Stock Quote Form
To secure the one year graphic charts
from Yahoo Finance click this link:
http://finance.yahoo.com/q?s=DELL&d=1ym
The link above has a specific textual reference to the DELL stock. Would it not
be interesting if the stock textual element of the link could be altered.
The form below will permit data entry in a web page presentation, construct the
required URL format, then submit that URL to your browser as a link to display
to a new stock's one year graphic.
|
Cut and paste this code to your page.
Then comment out the current "image" INPUT statement and
utiltize the
"Submit" type INPUT statement.
In the HIDDEN INPUT tag, try these
"value" arguments: "1d", "5d", "3mm", "6m", "2ym" and "5ym".
|
<FORM METHOD=GET ACTION="http://quote.yahoo.com/q">
<FONT size=1 face="ms sans serif"><B>
<INPUT TYPE=TEXT NAME="s" SIZE=6>
<!-- INPUT TYPE=SUBMIT VALUE="Quote" -->
<INPUT TYPE=image
SRC="./images/quote35x21.gif"
ALIGN=absmiddle alt="get quote"
WIDTH="35" HEIGHT="21" BORDER="0">
<INPUT TYPE=HIDDEN NAME="d" VALUE="1ym"><BR>
from Yahoo! Fanance
</FORM>
|
What is the x:y coordinate for a particular location?
Having found and saved the image to the right,
it would be desirable to determine a way to click each
dot and link to a related set of pages.
Here we shall use a FORM block. But this set of code,
shown below the graphic, has a functional error,
but we will take advantage of the error.
Place your mouse point on a
seleted dot.
Then, click it!
An error page will be displayed. In the "Location" window of the
browser is a URL with two element, "map.x=" and "map.y=" values.
These are horizontal and vertical pixel measurements from the upper left corner
of the image.
Place your mouse point on a location other
that a dot, like you "hometown". Then, click it!
|
<FORM
ACTION="./cgi-bin/gather_aimage.txt">
<INPUT TYPE="image" NAME="map"
SRC="./usnexrad.gif">
<FORM> |
Coding Multiple Links within an Image?
|
Your First Web Project
Lets assume you are a college journalism student. You are interested in
becoming current news reporter.
You wish to read articles written by other reporters about current and
local events in their cities. In addition, you wish to be aware of activities
in your hometown newspaper.
After searching the web you have found the Web address of newspapers for
most of the "dots" of the image to the left.
Using the Anchor block, its USEMAP element, the
map coordinate FORM above, and the MAP block, you wrote the code below.
|
<A HREF="dummy.htm"></a>
<IMG SRC="./usnexrad.gif" WIDTH=375 HEIGHT=280
ALT="" BORDER=0 USEMAP="#NEXRADImageMap"></A>
<MAP NAME="NEXRADImageMap">
<AREA SHAPE="RECT" COORDS="230,82,240,88"
HREF="http://www.chicagotribune.com/"
TARGET="_top" ALT="Chiago, IL"
OnMouseOver="on('Chicago, IL'); window.status='Chicago, IL'; return true"
OnMouseOut="off(); window.status=''; return true">
<AREA SHAPE="RECT" COORDS="260,81,268,87"
HREF="http://www.advertiser-tribune.com/"
TARGET="_top" ALT="Tiffin, OH"
OnMouseOver="on('Tiffin, OH'); window.status='Tiffin, OH'; return true"
OnMouseOut="off(); window.status=''; return true">
</MAP>
|
Author's Forms Notes___
Top-of-Page/Menu
|