Books
in black and white
Main menu
Home About us Share a book
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Javascript for dummies. Quick Reference - Vander

Vander Javascript for dummies. Quick Reference - Wiley Publishing, 2002. - 115 p.
Download (direct link): javascriptquickreference2002.pdf
Previous << 1 .. 7 8 9 10 11 12 < 13 > 14 15 16 17 18 19 .. 72 >> Next

</FRAMESET> Closing </FRAMESET> tag
Here’s an example of code that defines two frames:
<HTML>
<HEADXTITLE>Frames Examp 1 e</TITLEX/HEAD> <FRAMESET R0WS="50%,50%" C0LS="40%,60%"> <FRAME SRC="framconl.html" NAME="framel"> <FRAME SRC="framcon2.html" NAME="frame2"> </FRAMESET>
</HTML>
Hypertext anchor: <A>... </A>
An anchor is a piece of text that uniquely identifies a spot on a Web page. After you define an anchor, you (or any other HTML author) can link to it.
To define an anchor in HTML, use this tag pair: <A> . . . </A>
To access that anchor in JavaScript, use this identifier:
document.1inks[0]
In the preceding JavaScript identifier, 0 is a number representing the order in which the anchor was defined in the HTML code. The first anchor is represented by 0; the second, by 1; the third, by 2; and so on.
Inserting Form Elements into four Web Page
You may notice that the < A>. . . < / A> tag pair is used for both anchors and links. If you want, you can use one <A> . . . </A> tag pair to define a single piece of text that’s both a link and an anchor.
Tag Syntax for an Anchor Explanation
<A Opening <A> tag
NAME="anchorName"> Name of anchor to which the links refers
anchorText Text to display at the anchor site
</A> Closing </A> tag
Here’s a down-and-dirty anchor definition:
<A NAME="TOC">Table of Contents</A>
Hypertext link: <A>... </A>
Hypertext links (or just plain links') are at the heart of the Web’s usefulness. You can use links to connect and organize multiple pages of your own, to connect your pages with other Web pages, or both. Technically, a link is a piece of text (or an image) that loads another Web page when you click on it. (A link sometimes loads a specific spot, or anchor; on the other Web page.)
To define a hypertext link in HTML, use this tag pair: <A> . . . < / A>
To access that link in JavaScript, use this identifier:
document.1i nks[0]
In the preceding JavaScript identifier, 0 is a number representing the order in which the link was defined in the HTML code. The first link is represented by 0; the second, by 1; the third, by 2; and so on.
Tag Syntax for a Link Explanation
<A Opening <A> tag
HREF="1ocati onOrURL[#anchor]" URL and (if appropriate) anchor to link to
[TARGET="wi ndowName"] Window to load linked page into (optional)
[onClick="handlerText"] Code to invoke when a user clicks the link (optional)
[onMouse0ut="handlerText" ] Code to invoke when mouse moves off the link (optional)
[onMouseOver="handlerText"]> Code to invoke when mouse moves across the link (optional)
1i nkText Text to display at link site
</A> Closing </A> tag
Inserting Interactive Form Elements: <1NPUT>
Many of the link’s attributes are optional. You can use them all if you’re feeling frisky, but the following is a good example of all that’s really necessary to get the job done:
<A HREF="http://www.dummies.com"> Link to the IDG Dummies Press Web Site </A>
When you move your mouse pointer over the link, the value specified for the HREF attribute (in this case, it’s " http: / / www. dummi es . com") appears in the status line at the bottom of the browser. You don’t have to do anything special for this value to appear — the HTML interpreter does it for you automatically.
Inserting Interactive form Elements: <1NPUT>
To define an interactive input element in HTML, use this tag:
<INPUT NAME="myInput Element"...>
To access that element in JavaScript, use this identifier:
document.my Form.my Input Element
All the elements in this section are form elements and so must be defined between the <F0RM>. . .</F0RM> tags.
The interactive elements that you can create in JavaScript are actually HTML elements, with one very important difference: JavaScript lets you add event handlers (onClick, onChange, onBl ur, and so on) to elements so that the elements can respond to user interaction (see also Part VI). You can make several different types of input elements interactive with JavaScript:
Input Element Explanation
TYPE="button" A customizable push button
TYPE="checkbox" Grouped check boxes (which allow multiple selections)
TYPE="fi1 e" A control that lets users browse and choose files
TYPE="hi dden" A text element that users can't see
TYPE="password" A text element that displays characters as asterisks
TYPE="radi o" Grouped radio buttons (which restrict users to one selection)
TYPE="reset" Predefined button to reset form values
<SELECT> Configurable (single or multiple selection) list box
TYPE="submi t" Predefined button to submit form values
TYPE="text" Single line text input field
<TEXTAREA> Multiple line text input field
22 Inserting Interactive Form Elements: <IAJPUT>
The <SELECT>and <TEXTAREA> elements are input elements, too, but they’re defined a little differently than the others. (Go figure.) Instead of identifying values for the TYPE attribute of the < INPUT> tag, they have tags all their own:
<SE LECT>...</SELECT>
<TEXTAREA>...</TEXTAREA>
Button
Previous << 1 .. 7 8 9 10 11 12 < 13 > 14 15 16 17 18 19 .. 72 >> Next