13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

What Is Ajax?<br />

859<br />

display the h1 text however it has been defined—probably with a font size greater than<br />

12pt <strong>and</strong> with a font-weight value of bold.<br />

In addition to defining selectors, you can also define your own classes <strong>and</strong> IDs within<br />

a style sheet. Using classes (which can be used on multiple elements in a page) or IDs<br />

(which can be used only once within a page), you can further refine the display <strong>and</strong><br />

functionality of elements displayed within your website.This refinement is especially<br />

important in Ajax-enabled sites because you use predefined areas of your document to<br />

display new information retrieved from the remote scripting action.<br />

Classes are defined similarly to selectors—curly braces around the definitions, definitions<br />

separated by semicolons. Following is the definition of a class called ajaxarea:<br />

.ajaxarea {<br />

width: 400px;<br />

height: 400px;<br />

background: #fff;<br />

border: 1px solid #000;<br />

}<br />

In this instance, the ajaxarea class, when applied to a div container, produces a 400-<br />

pixel wide by 400-pixel high square with a white background <strong>and</strong> a thin black border.<br />

The usage is as follows:<br />

some text<br />

The most common method of using style sheets is to create a separate file with all the<br />

style definitions in it, <strong>and</strong> then link to it in the head element of your HTML document,<br />

like so:<br />

<br />

<br />

<br />

For more information on CSS, see http://www.w3.org/TR/CSS2/.<br />

Client-Side Programming<br />

Client-side programming occurs within your web browser after a page has been entirely<br />

retrieved from a web server. All the programming functions are included in the data<br />

retrieved from the web server <strong>and</strong> are waiting to be acted upon. Common actions performed<br />

on the client side include showing or hiding sections of text or images, changing<br />

the color, size, or location of text or images, performing calculations, <strong>and</strong> validating user<br />

input in a form before sending the form to be processed on the server side.<br />

The most common client-side scripting language is JavaScript—the “J” in Ajax.<br />

VBScript is another example of a client-side scripting language, although it is Microsoftspecific<br />

<strong>and</strong> thus not a good choice for an open environment in which all manner of<br />

operating systems <strong>and</strong> web browsers may be in use.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!