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 .. 8 9 10 11 12 13 < 14 > 15 16 17 18 19 20 .. 72 >> Next

A button is a clickable push button on an HTML form.
Tag Syntax for a Button Explanation
< INPUT Single < IN PUT> tag
TYPE="button" Specifies the kind of input control (button)
NAME="buttonName" Internal name of button (for coding purposes)
VALUE="buttonText" Text to display on face of button
[onClick="handlerText"]> Code to invoke when a user clicks the button
Here’s a real-life example:
<IN P UT TYPE="button" NAME=H i nfoButton" VALUE="C7 i ck Here for Info" onCl ick="display Info()”>
Check box
A check box is a toggle switch control. When users click a check box, they either check it (turn it on) or uncheck it (turn it off).
Tag Syntax for a Check Box Explanation
< IN PUT Single < IN PUT> tag
TYPE="checkbox" Specifies the type of control (check box)
NAME="checkboxName" Internal name of check box (for coding purposes)
VALUE="checkboxValue" Value returned to the server when the form is submitted
[CHECKED] Specifies initial display marked as checked (optional)
[onCli сk="handlerText"]> Code to invoke when check box is clicked (optional)
textToDisplay Descriptive text to display next to check box
Inserting Interactive Form Elements: <!NPUT> 23
Here’s how you might go about creating a check box:
<INPUT TYPE="checkbox" NAME="с lassi caj Checkbox”
VALUE="checkedClassica7"
onCl ick=”showClassicalTitles()"> Click here if you like classical music.
fiteUpload
A fileUpload element allows users to browse the file directories on their own machine and choose a file. Within a JavaScript script you can access the name of the chosen file with the fileUploadName. value, which you can then use however you see fit.
The fileUpload element is available only for Netscape Navigator 3.0 at the time of this writing.
Tag Syntax for fileUpload Explanation
<IN PUT Single <I NPUT> tag
TYPE="fi1e" Specifies the type of element (file)
NAME="fi1eUploadName"> Specifies the name of the element
Here’s what the definition of a fileUpload element looks like:
< IN PUT TYPE=" f i 1 e" HME=”myFi leUpload" >
Hidden
A hidden element is an input text field that doesn’t appear on-screen. Hidden elements are usually used to store programmer-calculated values (behind-the-scenes program stuff) that get sent to the server when the user submits a form.
Tag Syntax for a Hidden Element Explanation
CINPUT Single < IN PUT> tag
TYPE»"hidden" Specifies the type of element (hidden)
NAME="hi ddenName" Internal name of hidden element (used in coding)
[VALUE="textValue"]> Initial value of hidden object (optional)
Here’s a garden-variety definition for a hidden element:
<INPUT TYPE="hidden" NAME="secretTextField">
inserting Interactive Form Elements: <1NPUT>
Password
A password object is a special text input field that displays asterisks on the screen (in place of the characters that the user actually types).
Tag Syntax for a Password Explanation
<INPUT Single <INPUT> tag
TYPE=" password" Specifies the type of element (password)
NAME="passwordName" Internal name of password (for coding
purposes)
SIZE=integer Number of characters to display initially
[VALUE = "textValue"]> Initial value of password (optional)
Take a look at this sample password definition:
<IN P UT TYPE="password" NAME="userPassword" SIZE=15 VALUE="secret!">
Radio button
A radio button is a toggle switch control, as is a check box. Unlike a check box, however, radio buttons are most often grouped in sets, which allow users to select a single option from a list.
Tag Syntax for a Radio Button Explanation
CINPUT Single <INPUT> tag
TYPE="radi o" Specifies the kind of element (radio)
NAME="radi oName" Internal name of radio button (for coding purposes)
VALUE="radi oValue" Specifies a value to be returned to the server
[CHECKED] Specifies that this button is initially selected (optional)
[onCli ck="hand1erText"]> Code to invoke when user clicks on radio button (optional)
textToDisplay Descriptive text
The following code shows a common way to define a set of radio buttons. Notice how the value for the NAME attribute is the same (ti meChoi ce) for every radio button? Because all three radio buttons share one name (and only one value can be associated with one name at a time), the user is effectively restricted to selecting only one radio button from the entire group.
Inserting Interactive Form Elements: <1NPUT> 25
_____________________________________________________________
What's your favorite time of day? <IN P UT TYPE="radi o" NAME="timeChoi ce" VALUE="morningSelected" CHECKED onClick="showValues(O)"> Morning <IN P UT TYPE="radio" NAME="timeChoice" VALUE="afternoonSe1ected" onClick="showValues(l)”> Afternoon
< IN PUT TYPE=" r.adi o" NAME=" t imeChoi ce"
VALUE="eveningSelected" onClick="showValues(2)"> Evening
Reset
A reset object is a special kind of button. When a user clicks on the reset button, all the user-input values in a form are cleared and reset to their initial (default) values.
Tag Syntax for a Reset Button Explanation
Previous << 1 .. 8 9 10 11 12 13 < 14 > 15 16 17 18 19 20 .. 72 >> Next