PowerPoint Slideshow about 'How to Create Your Own Website' - moesha
Download NowAn Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
This class manipulates text data and is very often used. Access is through objects.
var txt = new String(“text”); //OR
var txt = “text”;
Functions: (These return new strings rather than modifying them in place)
txt.toUpperCase(): Converts all letters to uppercase.
txt.toLowerCase(): Converts all letters to lowercase.
txt.indexOf(query, start): Returns the position that the string represented by query was found in txt (or -1 if not found). The start parameter is optional, and represents the position in txt to start from.
txt.replace(findstr, replacestr): Replaces all occurrences of findstr in txt with replacestr.
txt.substring(startpos, endpos): Extracts the part of the string between startpos and endpos (positions are 0 for the first character, 1 for the second, etc.)
endpos is optional. If omitted, it is treated as the end of the string.
txt.split(separator): Splits the string into an array of smaller strings, delimited by the specified separator.
Also a large number of functions that will wrap text in HTML tags:
txt.link(url): turns txt into a hyperlink pointing to url.
txt.bold(), txt.italic(), txt.big(), txt.small(), etc.
Documents themselves, form fields, links, frames, buttons, objects, images… all have corresponding classes!
And like the standard classes, these all have functions and fields.
There are far too many of these to cover all of them.
But there are fortunately some “rules” that they follow.
All elements inherit from the Node and Element classes.
This means that they can use all of the functions and variables defined in those two classes.
Be careful; while most Node functions are supported by every browser, many of the Element functions are IE-specific.
Many of the variables correspond to attribute names of the corresponding tags; e.g. the Anchor class (<a> tag) has a variable called “href”, which can be retrieved or set and which contains the destination of the link.
All elements additionally have a “style” variable, which itself contains variables corresponding to CSS rules:
E.g. elem.style.backgroundColor, elem.style.borderStyle, elem.style.display