Documente Academic
Documente Profesional
Documente Cultură
LAYOUT
Web page layout is very important to give better look to your website. You should design your webpage layout very carefully. You may have noticed that there are many websites which have put their content in multiple columns - they are formatted like a magazine or newspaper. This is easily achieved by using tables or division or span tags. Sometime you use CSS as well to position various elements or to create backgrounds or colorful look for the pages.
This will produce following result: To Become more comfortable - Do Online Practice
</td> <td style="background-color:#FFCCFF; width:20%;text-align:top;"> <b>Right Menu</b><br /> HTML<br /> PHP<br /> PERL... </td> </tr> <table>
<div style="background-color:#FFCCFF; height:200px;width:100px;float:left;"> <b>Main Menu</b><br /> HTML<br /> PHP<br /> PERL... </div> <div style="background-color:#eeeeee; height:200px;width:300px;float:left;"> Technical and Managerial Tutorials </div> <div style="background-color:#CC99FF;clear:both"> <center> Copyright 2007 Tutorialspoint.com </center> </div> </div>
DOCTYPE
Document Type Declaration
From Wikipedia, the free encyclopedia Jump to: navigation, search
A Document Type Declaration, or DOCTYPE, is an instruction that associates a particular SGML or XML document (for example, a webpage) with a Document Type Definition (DTD) (for example, the formal definition of a particular version of HTML). In the serialized form of the document, it manifests as a short string of markup that conforms to a particular syntax. The HTML layout engines in modern web browsers perform DOCTYPE "sniffing" or "switching", wherein the DOCTYPE in a document served as text/html determines a layout mode, such as "quirks mode" or "standards mode". The text/html serialization of HTML5, which is not SGML-based, uses the DOCTYPE only for mode selection. Since web browsers are implemented with special-purpose HTML parsers, rather than general-purpose DTD-based parsers, they don't use DTDs and will never access them even if a URL is provided. The DOCTYPE is retained in HTML5 as a "mostly useless, but required" header only to trigger "standards mode" in common browsers.[ A <!DOCTYPE> declaration helps the browser to display a web page correctly.
Syntax
The general syntax for a document type declaration is:
<!DOCTYPE root-element PUBLIC "FPI" ["URI"] [ <!-- internal subset declarations --> ]>
or
<!DOCTYPE root-element SYSTEM "URI" [ <!-- internal subset declarations --> ]>
In XML, the root element that represents the document is the first element in the document. For example, in XHTML, the root element is <html>, being the first element opened (after the doctype declaration) and last closed. The keywords SYSTEM and PUBLIC suggest what kind of DTD it is (one that is on a private system or one that is open to the public). If the PUBLIC keyword is chosen then this keyword is followed by a restricted form of "public identifier" called Formal Public Identifier (FPI) enclosed in double quote marks. After that, necessarily, a "system identifier" enclosed in double quote marks, too, is provided. For example, the FPI for XHTML 1.1 is "-//W3C//DTD XHTML 1.1//EN" and, there are 3 possible system identifiers available for XHTML 1.1 depending on the needs, one of them is the URI reference "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd". If, instead, the SYSTEM keyword is chosen, only a system identifier must be given. It means that the XML parser must locate the DTD in a system specific fashion, in this case, by means of a URI reference of the DTD enclosed in double quote marks. The last part, surrounded by literal square brackets ([]), is called an internal subset which can be used to add/edit entities or add/edit PUBLIC keyword behaviours.[2] The internal subset is always optional (and sometimes even forbidden within simple SGML profiles, notably those for basic HTML parsers that don't implement a full SGML parser). On the other hand, document type declarations are slightly different in SGML-based documents such as HTML, where you may associate the public identifier with the system identifier. This association might be performed, e. g., by means of a catalog file resolving the FPI to a system identifier.[3]
Example
The first line of many World Wide Web pages reads as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="ar" dir="rtl" xmlns="http://www.w3.org/1999/xhtml">
This Document Type Declaration for XHTML includes by reference a DTD, whose public identifier is -//W3C//DTD XHTML 1.0 Transitional//EN and whose system identifier is http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd. An entity resolver may use either identifier for locating the referenced external entity. No internal subset has been indicated in this example or the next ones. The root element is declared to be html and, therefore, it is the first tag to be opened after the end of the doctype declaration in this example and the next ones,
too. The html tag is not part of the doctype declaration but has been included in the examples for orientation purposes.
Transitional DTD allows some older PUBLIC and attributes that have been deprecated:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html>
If frames are used, the Frameset DTD must be used instead, like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html>
Example
An HTML document with an HTML5 DOCTYPE: <!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> The content of the document...... </body> </html>
10
Common Declarations
HTML5
<!DOCTYPE html>
HTML 4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Choosing a DOCTYPE
According to HTML standards, each HTML document requires a document type declaration. The "DOCTYPE" begins the HTML document and tells a validator which version of HTML to use in checking the document's syntax. If standard HTML does not meet your needs but you still wish to gain the benefits of HTML validation, see the section on using a custom DTD. The following DOCTYPEs are commonly used:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
11
This declares the document to be HTML 4.01 Strict. HTML 4.01 Strict is a trimmed down version of HTML 4.01 that emphasizes structure over presentation. Deprecated elements and attributes (including most presentational attributes), frames, and link targets are not allowed in HTML 4 Strict. By writing to HTML 4 Strict, authors can achieve accessible, structurally rich documents that easily adapt to style sheets and different browsing situations. However, HTML 4 Strict documents may look bland on very old browsers that lack support for style sheets. Newer browsers such as Internet Explorer 5 for Mac, Netscape 6, and Mozilla use a standards-compliant rendering for HTML 4 Strict documents. These browsers use a "quirks" mode for most other document types to emulate rendering bugs in older browsers.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
This declares the document to be HTML 4.01 Transitional. HTML 4 Transitional includes all elements and attributes of HTML 4 Strict but adds presentational attributes, deprecated elements, and link targets. Newer browsers such as Internet Explorer 5 for Mac, Netscape 6, and Mozilla use a standards-compliant rendering for HTML 4.01 Transitional documents that include the URI of the DTD in the DOCTYPE. These browsers use a "quirks" mode to emulate rendering bugs in older browsers if the URI is omitted:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
This declares the document to be HTML 4.01 Frameset. HTML 4 Frameset is a variant of HTML 4 Transitional for documents that use frames.
12
This declares the document to be XHTML 1.0 Strict. XHTML 1.0 Strict is an XML version of HTML 4 Strict.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This declares the document to be XHTML 1.0 Transitional. XHTML 1.0 Transitional is an XML version of HTML 4 Transitional.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
This declares the document to be XHTML 1.0 Frameset. XHTML 1.0 Frameset is an XML version of HTML 4 Frameset.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
This declares the document to be HTML 3.2. HTML 3.2 is well supported by most browsers in use. However, HTML 3.2 has limited support for style sheets and no support for HTML 4 features such as frames and internationalization.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
This declares the document to be HTML 2.0. HTML 2.0 is widely supported by browsers but lacks support for tables, frames, and internationalization, as well as many commonly used presentational elements and attributes.
13
A URL can be composed of words, such as "w3schools.com", or an Internet Protocol (IP) address: 192.68.20.50. Most people enter the name of the website when surfing, because names are easier to remember than numbers. When you click on a link in an HTML page, an underlying <a> tag points to an address on the world wide web. A Uniform Resource Locator (URL) is used to address a document (or other data) on the world wide web. A web address, like this: http://www.w3schools.com/html/default.asp follows these syntax rules: scheme://host.domain:port/path/filename Explanation:
scheme - defines the type of Internet service. The most common type is http host - defines the domain host (the default host for http is www) domain - defines the Internet domain name, like w3schools.com :port - defines the port number at the host (the default port number for http is 80) path - defines a path at the server (If omitted, the document must be stored at the root directory of the web site) filename - defines the name of a document/resource
14
1. The name of the protocol used to transfer the resource over the Web. 2. The name of the machine hosting the resource. 3. The name of the resource itself, given as a path.
This URL may be read as follows: Use the HTTP protocol to transfer the data residing on the machine www.w3.org in the file /TR/WD-html4/cover.html URLs in general are case-sensitive (with the exception of machine names). There may be URLs, or parts of URLs, where case doesn't matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive. /u The character set of URLs that appear in HTML is specified in [RFC1738].
Fragment URLs
The URL specification en vigeur at the writing of this document ([RFC1738]) offers a mechanism to refer to a resource, but not to a location within a resource. The Web community has adopted a convention called "fragment URLs" to refer to anchors within an HTML document. A fragment URL ends with "#" followed by an anchor identifier. For instance, here is a fragment URL pointing to an anchor named section_2:
http://somesite.com/html/top.html#section_2
Relative URLs
A relative URL (defined in [RFC1808]) doesn't contain any protocol or machine information, and its path generally refers to an HTML document on the same machine as the current document. Relative URLs may contain relative path components (".." means the parent location) and may be fragment URLs.
15
Relative URLs may be resolved to full URLs, for example when the user attempts to follow a link from one document to another. [RFC1808] defines the normative algorithm for resolving relative URLs. The following description is for convenience only. Briefly, a full URL is derived from a relative URL by attaching a "base" part to the relative URL. The base part is a URL that may come from any or all of the following sources:
HTTP transfer protocol header information (see [RFC2068]). Metadata (the META element) in the HEAD section of an HTML document. Explicit base path information (the BASE element) in the HEAD section of an HTML document, or the CODEBASE attribute of the APPLET element.
[RFC1808] specifies the precedence among multiple sources of base information. For the purposes of this explanation, the last piece of base information takes precedence over the others and HTTP headers are considered to occur earlier than the document HEAD. If no explicit base information accompanies the document, the base URL is that which designates the location of the current document. Given a base URL and a relative URL (that does not begin with a slash), a full URL is derived as follows:
If the base URL ends with a slash the full URL is derived by appending the relative URL to the base URL. For example, if the base URL is http://nosite.com/dir1/dir2/ and the relative URL is gee.html, the derived URL is http://nosite.com/dir1/dir2/gee.html. If the base URL doesn't end with a slash, the last piece of the base URL is considered a resource, so the full URL is derived by appending the relative URL to the parent of the base URL. For example, if the base URL is http://nosite.com/dir1/dir2 and the relative URL is gee.html, the derived URL is http://nosite.com/dir1/gee.html
URLs in HTML
In HTML, URLs play a role in these situations:
When referring to metadata describing a document (see the HEAD element). When citing a external reference (see the Q, BLOCKQUOTE, INS, and DEL elements). When including an object directly in a document (see the OBJECT, IMG, MAP, FRAME, and IFRAME elements).
16
When linking to another document or program (see the BASE, A, LINK, AREA, FORM, INPUT, SCRIPT, and APPLET elements).
In each case, authors may use a full URL, a fragment URL, or a relative URL. Please consult the section on anchors for more information about links and URLs.
MAILTO URLs
In addition to HTTP URLs, authors might want to include MAILTO URLs (see [RFC1738]) in their documents. MAILTO URLs cause email to be sent to some email address. For instance, the author might create a link that, when activated, causes the user agent to open a mail program with the destination address in the "To:" field. MAILTO URLs have the following syntax:
mailto:email-address
User agents may support MAILTO URL extensions that are not yet Internet standards (e.g., appending subject information to a URL with the syntax "?Subject=my%20subject" where any space characters are replaced by "%20").
17
html anchor. The <space> character also needs to be encoded because is not allowed on a valid URL format. Also, some characters, such as "~" might not transport properly across the internet. What Should be URL Encoded? As a rule of thumb, any non alphanumeric character should be URL encoded. This of course applies to characters that are to be interpreted as is (ie: is not intend to have special meanings) . In such cases, there's no harm in URL-Encoding the character, even if the character actually does not need to be URL-Encoded.
URL encoding is the practice of translating unprintable characters or characters with special meaning within URLs to a representation that is unambiguous and universally accepted by web browsers and servers. These characters include:
ASCII control characters - Unprintable characters typically used for output control. Character ranges 00-1F hex (0-31 decimal) and 7F (127 decimal). A complete encoding table is given below. Non-ASCII control characters - These are characters beyond the ASCII character set of 128 characters. This range is part of the ISO-Latin character set and ncludes the entire "top half" of the ISO-Latin set 80-FF hex (128-255 decimal). A complete encoding table is given below. Reserved characters - These are special characters such as the dollar sign, ampersand, plus, common, forward slash, colon, semi-colon, equals sign, question mark, and "at" symbol. All of these can have different meanings inside a URL so need to be encoded. A complete encoding table is given below. Unsafe characters - These are space, quotation marks, less than symbol, greater than symbol, pound character, percent character, Left Curly Brace, Right Curly Brace , Pipe, Backslash, Caret, Tilde, Left Square Bracket , Right Square Bracket, Grave Accent. These character present the possibility of being misunderstood within URLs for various reasons. These characters should also always be encoded. A complete encoding table is given below.
The encoding notation replaces the desired character with three characters: a percent sign and two hexadecimal digits whose correspond to the position of the character in the ASCII character set.
18
Example:
One of the most common special characters is the space. You can't type a space in a URL directly. A space position in the character set is 20 hexadecimal. So you can use %20 in place a space when passing your request to the server.
http://www.example.com/new%20pricing.html
This URL actually retrieves a document named new pricing.html from the www.example.com
19
7 8 9 10 11 12 13 14 15 16 17 18 19 20
%07 %08 %09 %0a %0b %0c carriage return %0d %0e %0f %10 %11 %12 %13 %14
20
21 22 23 24 25 26 27 28 29 30 31 127
15 16 17 18 19 1a 1b 1c 1d 1e 1f 7f
%15 %16 %17 %18 %19 %1a %1b %1c %1d %1e %1f %7f
21
Decimal Hex Value Character URL Encode 128 129 130 131 132 133 134 135 136 137 138 139 140 80 81 82 83 84 85 86 87 88 89 8a 8b 8c %80 %81 %82 %83 %84 %85 %86 %87 %88 %89 %8a %8b %8c
22
141 142 143 144 145 146 147 148 149 150 151 152 153 154
8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a
%8d %8e %8f %90 %91 %92 %93 %94 %95 %96 %97 %98 %99 %9a
23
155 156 157 158 159 160 161 162 163 164 165 166 167 168
9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8
24
169 170 171 172 173 174 175 176 177 178 179 180 181 182
a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6
25
183 184 185 186 187 188 189 190 191 192 193 194 195 196
b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4
%b7 %b8 %b9 %ba %bb %bc %bd %be %bf %c0 %c1 %c2 %c3 %c4
26
197 198 199 200 201 202 203 204 205 206 207 208 209 210
c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2
%c5 %v6 %c7 %c8 %c9 %ca %cb %cc %cd %ce %cf %d0 %d1 %d2
27
211 212 213 214 215 216 217 218 219 220 221 222 223 224
d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0
%d3 %d4 %d5 %d6 %d7 %d8 %d9 %da %db %dc %dd %de %df %e0
28
225 226 227 228 229 230 231 232 233 234 235 236 237 238
e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee
%e1 %e2 %e3 %e4 %e5 %e6 %e7 %e8 %e9 %ea %eb %ec %ed %ee
29
239 240 241 242 243 244 245 246 247 248 249 250 251 252
ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc
%ef %f0 %f1 %f2 %f3 %f4 %f5 %f6 %f7 %f8 %f9 %fa %fb %fc
30
fd fe ff
31
63 64
3f 40
? @
%3f %40
space %20 " < > # % { } | %22 %3c %3e %23 %25 %7b %7d %7c
32
92 94 126 91 93 96
5c 5e 7e 5b 5d 60
\ ^ ~ [ ] `
HTML Script
Introduction to scripts
A client-side script is a program that may accompany an HTML document or be embedded directly in it. The program executes on the client's machine when the document loads, or at some other time such as when a link is activated. HTML's support for scripts is independent of the scripting language. Scripts offer authors a means to extend HTML documents in highly active and interactive ways. For example:
Scripts may be evaluated as a document loads to modify the contents of the document dynamically. Scripts may accompany a form to process input as it is entered. Designers may dynamically fill out parts of a form based on the values of other fields. They may also ensure that input data conforms to predetermined ranges of values, that fields are mutually consistent, etc. Scripts may be triggered by events that affect the document, such as loading, unloading,
33
element focus, mouse movement, etc. Scripts may be linked to form controls (e.g., buttons) to produce graphical user interface elements.
There are two types of scripts authors may attach to an HTML document:
Those that are executed one time when the document is loaded by the user agent. Scripts that appear within a SCRIPT element are executed when the document is loaded. For user agents that cannot or will not handle scripts, authors may include alternate content via the NOSCRIPT element. Those that are executed every time a specific event occurs. These scripts may be assigned to a number of elements via the intrinsic event attributes.
34
Example
<script type="text/javascript"> document.write("Hello World!") </script>
Example
<script type="text/javascript"> document.write("Hello World!") </script> <noscript>Sorry, your browser does not support JavaScript!</noscript>
35
charset(character encodings)
The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document. The script may be defined within the contents of the SCRIPT element or in an external file. If the src attribute is not set, user agents must interpret the contents of the element as the script. If the src has a URI value, user agents must ignore the element's contents and retrieve the script
36
via the URI. Note that the charset attribute refers to the character encoding of the script designated by the src attribute; it does not concern the content of the SCRIPT element. Scripts are evaluated by script engines that must be known to a user agent. The syntax of script data depends on the scripting language.
Authors should specify the default scripting language for all scripts in a document by including the following META declaration in the HEAD:
<META http-equiv="Content-Script-Type" content="type">
where "type" is a content type naming the scripting language. Examples of values include "text/tcl", "text/javascript", "text/vbscript". In the absence of a META declaration, the default can be set by a "Content-Script-Type" HTTP header.
Content-Script-Type: type
where "type" is again a content type naming the scripting language. User agents should determine the default scripting language for a document according to the following steps (highest to lowest priority):
1. If any META declarations specify the "Content-Script-Type", the last one in the character stream determines the default scripting language. 2. Otherwise, if any HTTP headers specify the "Content-Script-Type", the last one in the character stream determines the default scripting language.
37
Documents that do not specify default scripting language information and that contain elements that specify an intrinsic event script are incorrect. User agents may still attempt to interpret incorrectly specified scripts but are not required to. Authoring tools should generate default scripting language information to help authors avoid creating incorrect documents.
Local declaration of a scripting language
The type attribute must be specified for each SCRIPT element instance in a document. The value of the type attribute for a SCRIPT element overrides the default scripting language for that element. In this example, we declare the default scripting language to be "text/tcl". We include one SCRIPT in the header, whose script is located in an external file and is in the scripting language "text/vbscript". We also include one SCRIPT in the body, which contains its own script written in "text/javascript".
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>A document with SCRIPT</TITLE> <META http-equiv="Content-Script-Type" content="text/tcl"> <SCRIPT type="text/vbscript" src="http://someplace.com/progs/vbcalc"> </SCRIPT> </HEAD> <BODY> <SCRIPT type="text/javascript"> ...some JavaScript... </SCRIPT> </BODY> </HTML>
Each scripting language has its own conventions for referring to HTML objects from within a script. This specification does not define a standard mechanism for referring to HTML objects. However, scripts should refer to an element according to its assigned name. Scripting engines should observe the following precedence rules when identifying an element: a name attribute takes precedence over an id if both are set. Otherwise, one or the other may be used.
38
39
onmouseover = script [CT] The onmouseover event occurs when the pointing device is moved onto an element. This attribute may be used with most elements. onmousemove = script [CT] The onmousemove event occurs when the pointing device is moved while it is over an element. This attribute may be used with most elements. onmouseout = script [CT] The onmouseout event occurs when the pointing device is moved away from an element. This attribute may be used with most elements. onfocus = script [CT] The onfocus event occurs when an element receives focus either by the pointing device or by tabbing navigation. This attribute may be used with the following elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON. onblur = script [CT] The onblur event occurs when an element loses focus either by the pointing device or by tabbing navigation. It may be used with the same elements as onfocus. onkeypress = script [CT] The onkeypress event occurs when a key is pressed and released over an element. This attribute may be used with most elements. onkeydown = script [CT] The onkeydown event occurs when a key is pressed down over an element. This attribute may be used with most elements. onkeyup = script [CT] The onkeyup event occurs when a key is released over an element. This attribute may be used
40
with most elements. onsubmit = script [CT] The onsubmit event occurs when a form is submitted. It only applies to the FORM element. onreset = script [CT] The onreset event occurs when a form is reset. It only applies to the FORM element. onselect = script [CT] The onselect event occurs when a user selects some text in a text field. This attribute may be used with the INPUT and TEXTAREA elements. onchange = script [CT] The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA.
It is possible to associate an action with a certain number of events that occur when a user interacts with a user agent. Each of the "intrinsic events" listed above takes a value that is a script. The script is executed whenever the event occurs for that element. The syntax of script data depends on the scripting language. Control elements such as INPUT, SELECT, BUTTON, TEXTAREA, and LABEL all respond to certain intrinsic events. When these elements do not appear within a form, they may be used to augment the graphical user interface of the document. For instance, authors may want to include press buttons in their documents that do not submit a form but still communicate with a server when they are activated. The following examples show some possible control and user interface behavior based on intrinsic events. In the following example, userName is a required text field. When a user attempts to leave the field, the onblur event calls a JavaScript function to confirm that userName has an acceptable value.
41
Here is a JavaScript example for event binding within a script. First, here's a simple click handler:
<BUTTON type="button" name="mybutton" value="10"> <SCRIPT type="text/javascript"> function my_onclick() { . . .
42
Note that "document.write" or equivalent statements in intrinsic event handlers create and write to a new document rather than modifying the current one.
43
Their combined generated text is inserted in the document in place of the SCRIPT element. 3. The generated CDATA is re-evaluated.
HTML documents are constrained to conform to the HTML DTD both before and after processing any SCRIPT elements. The following example illustrates how scripts may modify a document dynamically. The following script:
<TITLE>Test Document</TITLE> <SCRIPT type="text/javascript"> document.write("<p><b>Hello World!<\/b>") </SCRIPT>
44
The user agent is configured not to evaluate scripts. The user agent doesn't support a scripting language invoked by a SCRIPT element earlier in the document.
User agents that do not support client-side scripts must render this element's contents. In the following example, a user agent that executes the SCRIPT will include some dynamically created data in the document. If the user agent doesn't support scripts, the user may still retrieve the data through a link.
<SCRIPT type="text/tcl"> ...some Tcl script to insert data... </SCRIPT> <NOSCRIPT> <P>Access the <A href="http://someplace.com/data">data.</A> </NOSCRIPT>
45
document.write("The function returned ",square(5),".") // end hiding contents from old browsers --> </SCRIPT>
Commenting scripts in VBScript In VBScript, a single quote character causes the rest of the current line to be treated as a comment. It can therefore be used to hide the string "-->" from VBScript, for instance:
<SCRIPT type="text/vbscript"> <!-Sub foo() ... End Sub ' --> </SCRIPT>
Commenting scripts in TCL In Tcl, the "#" character comments out the rest of the line:
<SCRIPT type="text/tcl"> <!-- to hide script contents from old browsers proc square {i} { document write "The call passed $i to the function.<BR>" return [expr $i * $i] } document write "The function returned [square 5]." # end hiding contents from old browsers --> </SCRIPT>
HTML Entities
Some characters are reserved in HTML. It is not possible to use the less than (<) or greater than (>) signs in your text, because the browser will mix them with tags.
46
To actually display reserved characters, we must use character entities in the HTML source code. A character entity looks like this: &entity_name; OR &#entity_number; To display a less than sign we must write: < or <
Non-breaking Space
A common character entity used in HTML is the non-breaking space ( ). Browsers will always truncate spaces in HTML pages. If you write 10 spaces in your text, the browser will remove 9 of them, before displaying the page. To add spaces to your text, you can use the character entity.
47
® ™
HTML Webserver
After HTML coding process is completed, the webpage needs to be published, to make it available for the audience. To enable this, it is necessary to save the webpage on a web server. After IIS or PWS installation, any PC can serve as a web server. IIS or PWS are web server components. IIS contains a set of services designed specifically for MS Windows. It is included into Win 2000, Win XP and Vista. It is quite easy to install and use this application. IIS includes Active Server Pages, which can be used for making interactive and dynamic web applications. Personal Web Server is designed for use with older versions of WindowsOS, such as Win 95, Win 98, and Win NT. It is recommended to use IIS, because it more up-to-date and secure.
Hardware Expenses
To run a "real" web site, you will have to buy some powerful server hardware. Don't expect that a low cost PC will do the job. You will also need a permanent (24 hours a day ) high-speed connection.
Software Expenses
Remember that server-licenses often are higher than client-licenses. Also note that serverlicenses might have limits on number of users.
Labor Expenses
Don't expect low labor expenses. You have to install your own hardware and software. You also
48
have to deal with bugs and viruses, and keep your server constantly running in an environment where "everything could happen".
Connection Speed
Most ISPs have very fast connections to the Internet.
Powerful Hardware
ISPs often have powerful web servers that can be shared by several companies. You can also expect them to have an effective load balancing, and necessary backup servers.
49
Daily Backup
Make sure your ISP runs a daily backup routine, otherwise you may lose some valuable data.
Traffic Volume
Study the ISP's traffic volume restrictions. Make sure that you don't have to pay a fortune for unexpected high traffic if your web site becomes popular.
E-mail Capabilities
Make sure your ISP supports the e-mail capabilities you need.
Database Access
If you plan to use data from databases on your web site, make sure your ISP supports the database access you need.
50