Showing posts with label web-programming. Show all posts
Showing posts with label web-programming. Show all posts

March 11, 2008

Dates and Time in PHP

In this section we will be guided through PHP's functions related to time.
1. getdate
One of the most important functions is the getdate function. It returns the current date in an array of values that can be used for further treatment. Let's take a look at an example:
<?php        
$mydate = getdate();
echo "seconds: ".$mydate['seconds']."<br>";
echo "minutes: ".$mydate['minutes']."<br>";
echo "hours: ".$mydate['hours']."<br>";
echo "mday: ".$mydate['mday']."<br>";
echo "wday: ".$mydate['wday']."<br>";
echo "mon: ".$mydate['mon']."<br>";
echo "year: ".$mydate['year']."<br>";
echo "yday: ".$mydate['yday']."<br>";
echo "weekday: ".$mydate['weekday']."<br>";
echo "month: ".$mydate['month']."<br>";
?>

First the current time is computed. In the next step, the values stored in the array are displayed.
seconds: 2
minutes: 17
hours: 16
mday: 02
wday: 6
mon: 1
year: 2008
yday: 11
weekday: Saturday
month: January

2. date and mktime
Sometimes we want a date to be displayed in a certain format. For this purpose, we can use a function called date. Let's take a look at an example:
<?php     
echo date("Y-m-d H:i:s");
?>

The date is displayed in the same way we have already seen when dealing with PostgreSQL:
2008-01-02 21:38:19  

However, with the help of date we can do even more. In general the date function is used to format a date to our needs. If we want to format any date, we pass it to the function; otherwise, the current date will be used. Let's see how this can be done:
<?php  
echo date("Y-m-d H:i:s", mktime(23,9,4,02,1,2008))."<br>";
echo date("Y-m-d, h a", mktime(23,9,4,02,1,2008))."<br>";
echo date("Y-m-d, z", mktime(23,9,4,02,1,2008))."<br>";
?>

The first line displays the date passed to the function by computing the result of the mktime function. mktime takes the input parameters and makes a date out of it. The result of this function can be used as input for the date function. In the first example the date including the time is displayed. In the second example we can see that 23 o'clock is equal to 11 p.m. The third example shows how many days in the year have passed until the date passed to the function.
If we execute the script, three lines will be displayed:
2008-02-01 23:09:04  
2008-02-01, 11 pm
2008-02-01, 334

So far, we have seen the most important flags of the date command. The following list shows all the flags and formats accepted by date:

  • a— Displays "am" (ante meridiem) or "pm" (post meridiem)
  • A— Displays "AM" or "PM"
  • B— Swatch Internet time
  • d— Two digits defining the day of the month
  • D— Displays day of week using three letters
  • F— Displays month as text
  • g— Displays the hour as number from 1 to 12
  • G— Displays the hour as number from 0 to 23
  • h— Displays the hour using two digits (01–12)
  • H— Displays the hour using two digits (00–23)
  • i— Displays the minutes as two digits (00–59)
  • I— "1" if Daylight Savings Time, "0" otherwise
  • j— Day of the month (1–31)
  • l— Displays day of the week as text
  • L— Boolean value defining whether a year is a leap year
  • m— Displays month using two digits (01–12)
  • M— Displays months using text
  • n— Displays month without using leading zero
  • O— Difference relative to GMT
  • r— RFC-822 formatted date
  • s— Displays second using two digits (00–59)
  • S— Displays English ordinal suffixes
  • t— Number of days in a given month
  • T— Displays the time zone the local machine is in
  • U— Seconds since Unix starting time (January 1, 1970)
  • w— Displays day of week as number (0=Sunday; 6=Saturday)
  • W— ISO-8601 week number of year, weeks starting on Monday
  • Y— Displays year using 4 digits (2004)
  • y— Displays year using 2 digits (99)
  • z— Day of year
  • Z— Time zone offset in seconds


3. checkdate
To find out if a date is valid, PHP provides a function called checkdate. The function accepts three parameters. The first one defines the month, the second one the day, and the third one the year of the date. When checking the date, leap years are taken into consideration.
Let's see how this function can be used:
<?php       
if (checkdate(12, 1, 2008)) {
echo "date valid<br>\n";
}
else {
echo "date invalid<br>\n";
}
if (checkdate(12, 1, 200800)) {
echo "date valid<br>\n";
}
else {
echo "date invalid<br>\n";
}
?>

The first date is valid, but the second one isn't:
date valid 
date invalid


4.gettimeofday

The gettimeofday function returns the current date in an array. In contrast to the getdate function, gettimeofday returns microseconds, seconds, the minutes west of Greenwich, and the type of DST (Daylight Saving Time) correction. The next listing contains an example:
<?php    
$mydate = gettimeofday();
echo "sec: ".$mydate['sec']."<br>\n";
echo "usec: ".$mydate['usec']."<br>\n";
echo "minuteswest: ".$mydate['minuteswest']."<br>\n";
echo "dsttime: ".$mydate['dsttime']."<br>\n";
?>

Four lines will be displayed:
sec: 1205255935
usec: 546879
minuteswest: -420
dsttime: 0

The third line especially will be important because the content of the third field will help we when working with time zones. In this scenario we are two hours east of Greenwich (two hours in front).
5. gmtime
If we want a result to be displayed using GMT (Greenwich Mean Time), we can use gmtime instead of the date function. The advantage of this function is that we don't have to retrieve the current time zone and compute the offset to GMT. gmtime can do all these things for we:
<?php         
echo date ("M d Y H:i:s", mktime (22,39,18,02,1,2008))."<br>";
echo gmdate ("M d Y H:i:s", mktime (22,39,18,02,1,2008))."<br>";
?>

If we take a look at the next example, we will find out that the second line differs from the first line:
February 01 2008 22:39:18 
February 01 2008 21:39:18

6.gmmktime
The gmmktime function can be used to compute a Unix timestamp for a GMT date. Let's take a look at the syntax overview of the command:
int gmmktime (int hour, int minute, int second, int month, int day,  int year [, int is_dst])  

To compute the number of seconds passed until Unix starting time, we can use a script like the following:
<?php       
$x = gmmktime (1, 17, 53, 1, 13, 2008);
echo "x: $x<br>\n";
?>

More than one billion seconds have passed since Unix starting time:
x: 1200187073    



7 gmstrftime and strftime
To format a timestamp according to our needs, PHP provides two additional functions, which will be discussed in this section: gmstrftime and strftime. The difference between the two functions is that gmstrftime returns the data as GMT, whereas strftime uses the local settings to display the time. Let's take a look at an example:
<?php    
setlocale ('LC_TIME', 'en');
echo "GMT:<br>\n";
echo gmstrftime ("%b %d %Y %H:%M:%S",mktime (23, 19, 8 ,03 ,1 ,2008))."<br><br>\n";
echo "local settings:<br>\n";
echo strftime ("%b %d %Y %H:%M:%S",mktime (23, 19, 8 ,03 ,1 ,2008))."<br>\n";
?>

First the local setting is defined. In the next step the date passed to the mktime function is formatted according to the template passed to gmstrftime, and strftime functions as the first parameter. If we execute the script, several lines will be returned as we can see in the next listing:
GMT:  Mar 01 2008 16:19:08    
local settings: Jan 01 2008 23:19:08

8. localtime


PHP's localtime function is similar to Perl's localtime function. It returns the current local time as an array consisting of all necessary components:
<?php          
$mydate = localtime();
echo "tm_sec: ".$mydate[0]."<br>\n";
echo "tm_min: ".$mydate[1]."<br>\n";
echo "tm_hour: ".$mydate[2]."<br>\n";
echo "tm_mday: ".$mydate[3]."<br>\n";
echo "tm_mon: ".$mydate[4]."<br>\n";
echo "tm_year: ".$mydate[5]."<br>\n";
echo "tm_wday: ".$mydate[6]."<br>\n";
echo "tm_yday: ".$mydate[7]."<br>\n";
echo "tm_isdst: ".$mydate[8]."<br>\n";
?>

The array returned by PHP can be indexed easily, so it is an easy task to retrieve the data we need. When we execute the script, the array will be displayed line by line:
tm_sec: 59 
tm_min: 46
tm_hour: 13
tm_mday: 13
tm_mon: 0
tm_year: 102
tm_wday: 0
tm_yday: 12
tm_isdst: 0

9. time
PHP's time function returns the current Unix timestamp:
<?php  
echo time();
?>

More than a billion seconds have passed since Unix starting time:
1205254851

10. strtotime
To convert a string to a timestamp, PHP provides a function called strtotime. Various input formats are accepted by the function, so almost any useful format can be converted to a timestamp. The next example shows a variety of input formats accepted by strtotime:
<?php         
# valid dates:
echo "March 11 2008: ".strtotime("March 11 2008")."<br>\n";
echo "March 11 02: ".strtotime("March 11 02")."<br>\n";
echo "2008/3/11: ".strtotime("2008/3/11")."<br>\n";
echo "2008-3-11: ".strtotime("2008-3-11")."<br>\n";
echo "2008/3/11 18:32:17: ".strtotime("2008/3/11 18:32:17")."<br>\n";
echo "2008-3-11 18:32:17: ".strtotime("2008-3-11 18:32:17")."<br>\n";
# abbreviation
echo "3 months 12 days 29 seconds: ". strtotime("3 months 12 days 29 seconds")."<br>\n";
# in valid dates:
echo "13.1.2008: ".strtotime("13.1.2008");
?>

All formats but the German format we can see in the last line are accepted by PHP. As we have already seen, Unix timestamps are based on seconds. With the help of these simple formats, Unix timestamps are portable and interacting with other software products is easy. When we execute the script, we will see how the result is displayed:
 March 11 2008: 1205168400
March 11 02: 1205168400
2008/3/11: 1205168400
2008-3-11: 1205168400
2008/3/11 18:32:17: 1205235137
2008-3-11 18:32:17: 1205235137
3 months 12 days 29 seconds: 1019742570
13.1.2008: -1


11. microtime


Retrieving the current timestamp in microseconds, we can use the microtime function as explained in the next listing:
<?php      
$data = microtime();
$comp = split(" ", $data);
echo "usec: $comp[0]<br>\n";
echo "sec: $comp[1]<br>\n";
?>

The result of microtime is one string consisting of two components. The first one contains the number of microseconds. The second component contains the seconds that have passed since Unix starting time. If we execute the script in the previous listing, the result could look like this:
usec: 0.53125500
sec: 1205255325
Read More..
Share

PHP Quick Reference

PHP Syntax

The basic PHP syntax is as follows:


<?php

// enter lines of code, make sure they end with a semicolon;

?>


Displaying to Browser

To display text in a browser, use the following syntax:


<?php

echo “Enter text here”; //echo text

echo $variable; //echo values

echo “<br>”; //echo HTML text

?>


Assigning a Value to a Variable

To set a value to a variable, use the following syntax:


<?php

$varname = value; //for numeric

$varname = “value”; //for text

?>


Passing Variables

We can pass variables among pages in our Web site in three ways: through a URL, through sessions,

and through a form.

Through a URL

To pass a variable through a URL, use the following HTML code:


<a href=”http://www.localhost.com/index.php?varname=value”>


Through Sessions

To pass a variable through a session, use the following PHP code:


<?php //this must be the first line of the script, before HTML code

session_start(); //starts the session

$_SESSION[‘varname’] = value; //sets values for the entire session

$_SESSION[‘varname2’] = value;

?>

<?php //this must be the first few lines of every

//page accessing session variables

session_start();

?>


Through a Form

A form must reference the PHP script that will parse the variables:


<?php

$value = $_POST[‘varname’]; //this is how we will access the

//values from the form

?>


if Statements

To use if statements, type the following syntax:


<?php
if (this is true) //execute this command
?>

or

<?php

if (this is true) {

//execute command 1;

//execute command 2;

//execute command 3;


}

?>


else Statements

To use else statements, type the following syntax:


<?php

if (this is true) //execute this command;

else //execute this command

?>

or

else {

//execute command 1;

//execute command 2;

//execute command 3;


}

?>


Nested if Statements

We can use nested if statements by using the following syntax:

<?php

if (this is true) { //remember to use == for equals

if (this is true) //execute this command;

if (this is true) //execute this command;

else //execute this command;

}

?>


Including a File

To include a file, use the following syntax:


<?php include “header.php”; ?>, or

<?php require “header.php”; ?>



Using Functions

We can create and call functions using the following syntax:


<?php

function funcname()
{ //defines the function

//line of php code;

//line of php code;

//line of php code;


}

funcname(); //calls the function to execute

?>


Arrays

We can set the values for an array in one of two ways:


<?php

$name = array(“firstname”=>”ridho”, “lastname”=>”fitra”, “age”=”124”);

echo $name[“firstname”];

?>

or

<?php

$name[“firstname”] = “ridho”;

$name[“lastname”] = “fitra”;

$name[“age”] = 21;

?>


If no keys are required, we can set the values for an array like this:


<?php

$flavor[] = “infocomnet”;

$flavor[] = “ictworld2u”;

$flavor[] = “eurokickoff”;

?>


for

We can execute a block of code a specified number of times with the following for statement:


<?php

for ($n = 0; $n <= 10; $n=$n+1) {

//these lines will execute while the value ‘n’ is

//less than or equal to 10


echo $n;

echo “<br>”;

}


foreach

We can apply the same block of code to each value in a specified array with the foreach statement:


foreach ($arrayvalue as $currentvalue) {

//these lines will execute as long as there is a value in $arrayvalue

echo $currentvalue;

echo “<br>\n”;

}

Read More..
Share

February 17, 2008

HTML Code List


<!-- ••• --> 
<!DOCTYPE ...> 
<A ...> AnchorHREF: URL you are linking to
NAME: name a section of the page
TARGET = "_blank" | "_parent" | "_self" | "_top" | window name
which window the document should go in
TITLE: suggested title for the document to be opened
onClick: script to run when the user clicks on this anchor
onMouseOver: when the mouse is over the link
onMouseOut: when the mouse is no longer over the link
ACCESSKEY
<ADDRESS> 
<APP ...> 
<APPLET ...>CODE: the applet to run
CODEBASE: path to the applet class
WIDTH: width of the applet
HEIGHT: height of the applet
ALIGN = LEFT | RIGHT | TOP | MIDDLE | BOTTOM | BASELINE
alignment of applet to surrounding text
VSPACE: vertical space between applet and surrounding text
HSPACE: horizontal space between applet and surrounding text
BORDER: empty space surrounding the applet
NAME: name of applet for reference by other applets
ARCHIVE: a compressed collection of applet components
MAYSCRIPT: If Java can use JavaScript
<AREA ...>HREF: URL you are linking to
ALT: alternate text if the image isn't displayed
SHAPE = RECT | CIRCLE | POLY | DEFAULT
what shape is this area?
COORDS: coordinates for the link area shape
TITLE: Short description of the area
TARGET: what frame to go to
NOHREF: this area is not a link
onClick: script action when the user clicks this area
onMouseOver
onMouseOut
<B> Bold 
<BASE ...> Base addressHREF: default address for hypertext links
TARGET = "_blank" | code>"_parent" | "_self" | "_top" | frame name
default window for linked documents
<BASEFONT ...>SIZE
COLOR
FACE
<BGSOUND ...>SRC: URL of the sound
LOOP = INFINITE | number of loops
how many times to play the sound
<BIG> 
<BLINK> 
<BLOCKQUOTE ...> Block Quote 
<BODY ...>BGCOLOR: background color of the page
BACKGROUND: background picture for the page
TEXT: color of the text on the page
LINK: color of links that haven't been followed yet
VLINK: color of links that have been followed
ALINK: color of links while you are clicking on them
BGPROPERTIES = FIXED
if the background image should not scroll
TOPMARGIN: size of top and bottom margins
LEFTMARGIN: size of left and right margins
MARGINHEIGHT: size of top and bottom margins
MARGINWIDTH: size of left and right margins
onLoad: Script to run once the page is fully loaded
onUnload
onFocus
onBlur
STYLESRC: MS FrontPage extension
SCROLL = YES | NO
If the document should have a scroll bar
<BR ...> Line BreakCLEAR = LEFT | RIGHT | ALL | BOTH
go past a picture or other object
<BUTTON ...>TYPE = BUTTON | SUBMIT | RESET
what type of button is this
onClick: script to run when the user clicks here
NAME: name of this button element
VALUE: the value sent with the form
DISABLED: disable this button
ACCESSKEY: shortcut key for this button
TABINDEX: tab order
<CAPTION ...>ALIGN = TOP | BOTTOM | LEFT | RIGHT
alignment of caption to table
VALIGN = TOP | BOTTOM
if caption should be above or below table
<CENTER ...> 
<CITE> Citation 
<CODE> 
<COL ...> ColumnSPAN: how many columns this affects
ALIGN = LEFT | CENTER | RIGHT | JUSTIFY
horizontal alignment
WIDTH: width of the column
BGCOLOR: background color of the column
<COLGROUP ...> Column GroupSPAN: how many columns this affects
ALIGN: alignment of cell contents
WIDTH: Width of the column group
<COMMENT> 
<DD> Definition Description 
<DEL> Deleted 
<DFN> Definition 
<DIR ...> Directory List 
<DIV ...>ALIGN = LEFT | CENTER | RIGHT | JUSTIFY
text alignment
<DL ...> Definition ListCOMPACT: take up less space
<DT> Definition Term 
<EM> Emphasis 
<EMBED ...>SRC: URL of resource to be embedded
WIDTH: width of area in which to show resource
HEIGHT: height of area in which to show resource
ALIGN = ABSBOTTOM | code>ABSMIDDLE | MIDDLE | TEXTTOP | RIGHT | LEFT | BASELINE | CENTER | BOTTOM | TOP
how text should flow around the picture
NAME: name of the embedded object
PLUGINSPAGE: where to get the plugin software
PLUGINURL: where to get the JAR archive for automatic installation
HIDDEN = FALSE | TRUE
if the object is visible or not
HREF: make this object a link
TARGET: frame to link to
AUTOSTART = TRUE | FALSE
if the sound/movie should start automatically
LOOP = TRUE | FALSE | # of loops
how many times to play the sound/movie
PLAYCOUNT: how many times to play the sound/movie
VOLUME: how loud to play the sound
CONTROLS = VOLUMELEVER STOPBUTTON | PAUSEBUTTON | PLAYBUTTON | code>SMALLCONSOLE | CONSOLE
which sound control to display
CONTROLLER = TRUE | FALSE
if controls should be displayed
MASTERSOUND: indicates the object in a sound group with the sound to use
STARTTIME: how far into the sound to start and stop
ENDTIME: when to finish playing
<FIELDSET> 
<FONT ...>SIZE: size of the font
COLOR: color of the text
FACE: set the typestyle for text
POINT-SIZE
WEIGHT
<FORM ...>ACTION: URL of the CGI program
METHOD = GET | POST
how to transfer the data to the CGI
NAME: name of this form
ENCTYPE = "multipart/form-data" | "application/x-www-form-urlencoded" | "text/plain"
what type of form this is
TARGET = "_blank" | "_parent" | "_self" | "_top" | frame name
what frames to put the results in
onSubmit: script to run before the form is submitted
onReset: script to run before the form is reset
<FRAME ...>SRC: what file to put in the frame
NAME: the name of the frame
SCROLLING = YES | NO | AUTO
should the frame have a scrollbar?
NORESIZE: don't let the user make the frame bigger or smaller
FRAMEBORDER = YES | 1 | NO | 0
should this frame have a border?
BORDERCOLOR: color of the surrounding border
MARGINWIDTH: the internal left and right margins for the frame
MARGINHEIGHT: the internal top and bottom margins for the frame
<FRAMESET ...>COLS: how many cols in the frameset
ROWS: how many rows in the frameset
FRAMEBORDER = YES | 1 | NO | 0
if the frames should have borders
FRAMESPACING: space between the frames
BORDER: space between frames
BORDERCOLOR: color of frame borders
<H# ...> Headers<H1 ...>, <H2 ...>, <H3 ...>,
<H4 ...>,
<H5 ...>,
<H6 ...>
ALIGN = LEFT | code>RIGHT | CENTER | JUSTIFY
alignment
<HEAD> 
<HR ...> Horizontal RuleNOSHADE: don't use shadow effect
SIZE: height
WIDTH: horizontal width of the line
ALIGN = LEFT | RIGHT | CENTER
horizontal alignment of the line
COLOR: color of the line
<HTML> 
<HTMLPLUS ...> 
<HYPE> 
<I> Italics 
<IFRAME ...> Inline FrameSRC: URL of the document to go in the frame
HEIGHT: height of the inline frame
WIDTH: width of the inline frame
NAME: name of this inline frame
LONGDESC: URL of a long description of the contents of the frame
FRAMEBORDER = 1 | 0
if the frame should have a border around it
MARGINWIDTH: internal left/right margin for the frame
MARGINHEIGHT: internal top/bottom margin for the frame
SCROLLING = YES | NO | AUTO
if the frame should have scroll bars
ALIGN = LEFT | RIGHT | TOP | TEXTTOP | MIDDLE | ABSMIDDLE | CENTER | BOTTOM | ABSBOTTOM | BASELINE
alignment of the frame object to text around it
VSPACE: space above and below the frame
HSPACE: space to the left and right of the frame
<IMG ...> ImageSRC: where to get the picture
ALT: text to show if you don't show the picture
NAME
LONGDESC: URL of a long description of the image
WIDTH: how wide is the picture
HEIGHT: how tall is the picture
ALIGN = LEFT | RIGHT | TOP | TEXTTOP | MIDDLE | ABSMIDDLE | BOTTOM | ABSBOTTOM | BASELINE
how text should flow around the picture
BORDER: border around the picture
HSPACE: horizontal distance between the picture and the text
VSPACE: vertical distance between the picture and the text
ISMAP: is this a clickable map?
USEMAP: name of the map definition
LOWSRC: a version of the picture that isn't such a big file
NATURALSIZEFLAG: meaningless
NOSAVE: meaningless
DYNSRC: play a movie file
CONTROLS: show the buttons which control the movie
LOOP = INFINITE | -1 | # of loops
how many times to loop the movie
START = FILEOPEN | MOUSEOVER
when to start playing the movie
onLoad: script to runs after the image is downloaded
SUPPRESS = TRUE | FALSE
Don't show icons of images that haven't downloaded yet
<INPUT ...>TYPE = TEXT | CHECKBOX | RADIO | PASSWORD | HIDDEN | SUBMIT | RESET | BUTTON | FILE | IMAGE
what type of field
NAME: name of this form field
VALUE: initial or only value of this field
SIZE: how wide the text field should be
MAXLENGTH: maximum number of characters
CHECKED: check this checkbox or radio button
BORDER: border around image
SRC: URL of image
ALT: text to show if you don't show the picture
LOWSRC: a version of the picture that isn't such a big file
WIDTH: width of image
HEIGHT: height of image
ALIGN = LEFT | RIGHT | TOP | TEXTTOP | MIDDLE | ABSMIDDLE | CENTER | BOTTOM | ABSBOTTOM | BASELINE
how text should flow around the picture
VSPACE: vertical distance between the picture and the text
HSPACE: horizontal distance between the picture and the text
READONLY: the value of this field cannot be changed
DISABLED: don't let the user do anything with this field
ACCESSKEY
TABINDEX: tab order
LANGUAGE = "JavaScript" | "JavaScript1.1" | "JSCRIPT" | "VBScript" | "VBS" | other language
scripting language to use
onClick: when the user clicks here
onChange: when this field is changed
onFocus: when this field gets the focus
onBlur: when this field loses the focus
onKeyPress: script to run when a key is pressed
onKeyUp: script for when a key goes up while the field has the focus
onKeyDown: script for when a key goes down while the field has the focus
AUTOCOMPLETE = ON | OFF
If the browser should use autocompletion for the field
<INS> Inserted<DEL> 
<ISINDEX ...>PROMPT: prompt string to show before the text entry area
ACTION: the CGI to call
<KBD> Keyboard 
<LABEL ...>FOR: form element for which this is a label
<LEGEND ...>ALIGN = RIGHT | CENTER | LEFT
<LI ...> List ItemTYPE = DISC |CIRCLE | SQUARE | 1 | A | a | I | i
type of bullet or numeral
VALUE: where to continue counting
<LINK ...>REL: relationship to this page
REV: reverse relationship to this page
HREF: URL of related document
TITLE: suggested title
MEDIA = SCREEN |PRINT | PROJECTION | AURAL |BRAILLE | ALL | other media
What media type the link applies to
TYPE: MIME type of linked resource
<LISTING> 
<MAP ...>NAME: name of this map
<MARQUEE ...>WIDTH: how wide the marquee is
HEIGHT: how tall the marquee is
DIRECTION = LEFT | RIGHT
which direction the marquee should scroll
BEHAVIOR = SCROLL | SLIDE | ALTERNATE
what type of scrolling
SCROLLDELAY: how long to delay between each jump
SCROLLAMOUNT: how far to jump
LOOP = INFINITE | number of loops
how many times to loop
BGCOLOR: background color
HSPACE: horizontal space around the marquee
VSPACE: vertical space around the marquee
<MENU ...> 
<META ...>NAME = KEYWORDS | DESCRIPTION | REFRESH | many others
The pupose of this META tag
HTTP-EQUIV: Name of the pretend HTTP header
CONTENT: Metainformation content
<MULTICOL ...>COLS: how many columns
GUTTER: space between columns
WIDTH: width of a single column
<NOBR> No Break 
<NOEMBED> 
<NOFRAMES> 
<NOSCRIPT> 
<OL ...> Ordered ListTYPE = 1 | A | a | I | i
type of numerals
START: where to start counting
<OPTION ...>VALUE: what's the value if this option is chosen
SELECTED: this option is selected by default
<P ...> ParagraphALIGN = LEFT | CENTER | RIGHT | JUSTIFY
alignment of text within the paragraph
CLEAR = LEFT | RIGHT | ALL | BOTH
move past picture and other objects
<PARAM ...> ParameterNAME: name of the parameter
VALUE: value of the parameter
<PLAINTEXT> 
<PRE ...> Preformatted Text 
<S>Strikeout 
<SAMP> Sample 
<SCRIPT ...>TYPE = "text/javascript" | "text/vbscript" | other scripting language
Which scripting language to use
SRC: External source for script
DEFER: Continue loading page while downloading script
LANGUAGE = JAVASCRIPT | LIVESCRIPT | VBSCRIPT | other
Deprecated indicator of language
FOR: object for which this script is an event handler
EVENT: the event this script handles
<SELECT ...>NAME: name of this form element
MULTIPLE: allow more than one choice
SIZE: how many options to show
READONLY: don't let the user change the value of this field
DISABLED: don't let the user do anything with this field
LANGUAGE = "JavaScript" | "JavaScript1.1" | "VBScript" | other language
scripting language to use
onChange: what to do when a new option is selected
TABINDEX: tab order
onFocus: script to run when this field gets the focus
onBlur: script to run when this field loses the focus
<SMALL> 
<SOUND ...> 
<SPACER ...>TYPE = HORIZONTAL | VERTICAL | BLOCK
what type of space is this
ALIGN = LEFT | RIGHT
align left or right
SIZE: how tall or wide
WIDTH: how wide
HEIGHT: how tall
<SPAN ...> 
<STRIKE> Strikeout<S> 
<STRONG> 
<STYLE ...>TYPE: style language
MEDIA: type of media this syle applies to
<SUB> Subscript 
<SUP> Superscript 
<TABLE ...>BORDER: size of border around the table
CELLPADDING: space between the edge of a cell and the contents
CELLSPACING: space between cells
WIDTH: width of the table as a whole
BGCOLOR: color of the background
BACKGROUND: picture to use as background
ALIGN = LEFT | RIGHT
alignment of table to surrounding text
HSPACE: horizontal space between table and surrounding text
VSPACE: vertical space between table and surrounding text
HEIGHT: height of the table as a whole
FRAME = VOID | BOX | BORDER | ABOVE | BELOW | LHS | RHS | HSIDES | VSDES
parts of outside border that are visible
RULES = NONE | ALL | COLS | ROWS | GROUPS
if there should be internal borders
BORDERCOLOR: color of border around the table
BORDERCOLORLIGHT: color of "light" part of border around the table
BORDERCOLORDARK: color of "dark" part of border around the table
SUMMARY: Summary of the purpose of the table
<TBODY ...> Table Body Section 
<TD ...> Table DataALIGN = LEFT | CENTER | MIDDLE | RIGHT
horizontal alignment of cell contents
VALIGN = TOP | MIDDLE | CENTER | BOTTOM | BASELINE
vertical alignment of cell contents
WIDTH: width of cell
HEIGHT: height of cell
COLSPAN: number of columns to cover
ROWSPAN: number of rows to cover
NOWRAP: don't word wrap
BGCOLOR: color of the background
BORDERCOLOR: color of border around the table
BORDERCOLORDARK: color of "dark" part of border around the table
BORDERCOLORLIGHT: color of "light" part of border around the table
BACKGROUND: picture to use as background
<TEXTAREA ...>NAME: name of this form field
COLS: how many characters wide
ROWS: how many rows
WRAP = SOFT | HARD | OFF
how to wrap the text
READONLY: don't let the user change the contents of the field
DISABLED: don't let the user do anything with this field
TABINDEX: tab order
LANGUAGE = "JavaScript" | "JavaScript1.1" | "VBScript" | other language
scripting language
onChange: Script to run when the user has changed the textarea
onKeyPress: script to run when a key is pressed
<TFOOT ...> Table Footer Section 
<TH ...> Table Header 
<THEAD ...> Table Header Section<TBODY ...>, <TFOOT ...> 
<TITLE> 
<TR ...> Table RowALIGN = LEFT | CENTER | RIGHT
horizontal alignment of cell contents
HALIGN = LEFT | CENTER | RIGHT
VALIGN = TOP | MIDDLE | BOTTOM | BASELINE
vertical alignment of cell contents
BGCOLOR: background color
BACKGROUND: background image
BORDERCOLOR: color of border around each cell
BORDERCOLORLIGHT: color of "light" part of border around each cell
BORDERCOLORDARK: color of "dark" part of border around each cell
<TT> Teletype 
<U> Underline 
<UL ...> Unordered ListTYPE = DISC | CIRCLE | SQUARE
type of bullets
<VAR> Variable 
<WBR> 
<XMP> 

 


Courtesy www.htmlcodetutorial.com

Read More..
Share

Blogger template 'PlainFish' by Ourblogtemplates.com 2008