Sunteți pe pagina 1din 14

CS 301

COMPUTER PROGRAMMING 3
(WEB PAGE DESIGN & DEVELOPMENT)

1 Prelim – Lesson 2
BASIC ELEMENT OF A
FORM
FORM TAG: <form></form>

TEXTAREA TAG: <textarea></textarea>

2
-Allows user to enter free-form text information in an
open-minded edit field gives editable fields.

-SELECT TAG- <select></select>


-Name- same with textarea name
-Size- height of the list of selection
-Multiple – takes no value and allows multiple selection at a
time.
OPTION TAG: Defines each individual choice that the user
will see.
Variants
value- w hat will be associated with the name if that
option is chosen
selected- which option is selected by default when
choices are first displayed.
Example
<select name= “food”>
<option>cold pizza
<option>hut pizza
</select>

3
INPUT TAG:
Most flexible and the most complex and
produces lists of choices.
Text
Password
Radio
Reset
Submit

Variants:
Size- how many characters wide the text entry
field will be.
Maxlength- Maximum numbers of characters that
a user may enter into the field.
Value- maybe set to the default contents of the 4
field
Example:
<input type=“text” name=“a” size=20
maxlength=15>
<input type=“password” name=“pass” size=20
maxlength=15 value=“Password”>
<input type=“checkbox” name=“m”>Male
<input type=“checkbox” name=“f”>female
<input type=“radio” name=“w”
value=“wheat”>Wheat
<input type=“radio” name=“r” value=“rye”>Rye
<input type=“reset” value=“clear”>
<input type=“submit” value=“save”>
Checkbox- toggle that can be either on or off
5
STRING
Is more commonly referred to as text. It
contains a collection of different alpha –
numeric combination as well as punctuation. In

6
Javascript the string data type is used to
manage text contents of variables. It contains
methods and properties for better manipulation
of data.
METHOD DESCRIPTION
Anchor() Creates an HTML anchor

Big() Display a string in a big font

Blink() Display a blinking string

Bold() Display a string in bold

charAt() Returns the character at a


specified position
charcodeAt() Returns the unicode of the 7
character at a specified button
METHOD DESCRIPTION
Concat() Joins two or more
strings
Fixed() Displays a string as
teletype text
Fontcolor() Displays a string in a
specified color

Fontsize Displays a string in a


specified size
FromCharCode() Takes the specified
unicode values and
returns a string
charcodeAt() Returns the unicode of
the character at a
8

specified button
METHOD DESCRIPTION
indexOf() Returns the position of the first
occurrence of a specified string
value in a string
Italics() Display a string in italic

lastindexOf() Returns the position of the last


occurrence of a specified string
value, searching backwards from
the specified position in a string
Link() Displays s string as a hyperlink

Match() Searches for a specified value in


a string
Replace() Replaces some characters with 9

some other characters in a string


METHOD DESCRIPTION
Search() Searches a string for a specified
value
Slice() Extracts a part of a string and
returns the extracted part in a
new string
small() Displays string in a small font

Split() Splits a string into an array of


string
Strike() Displays a string with
strikethrough
Sub() Displays a string in subscript
10
METHOD DESCRIPTION
valueOf() Returns the primitive value of a
string object
Constructor A reference to the function that
created the object
Length Returns the number of
characters in a string

Prototype Allows you to add properties


and method to the object

11
METHOD DESCRIPTION
Substr() Extracts a specified number of
characters in a string from a
start index
Substring() Extracts the characters in a
string between two specified
indices
Sup() Display a blinking string

toLowerCase() Displays string in lowercase


letters
toUpperCase() Displays string uppercase
letters
toSource() Represents the source code of 12

an object
GETTING THE LENGTH OF THE
STRING
To get the length of a string, we
use the length property of the string

13
object. Properties are accessed by the
dot(.) operator
QUIZ / MACHINE PROBLEM

REVIEW… REVIEW…. REVIEW….

GOODLUCK!!!

14

S-ar putea să vă placă și