HOME
HTML
CSS
JAVASCRIPT
SQL
PHP
JQUERY
ANGULAR
BOOTSTRAP
XML
ASP.NET
MORE...
JavaScript Reference
Overview
JavaScript
JS String
JS Number
JS Operators
JavaScript and HTML DOM Reference
JS Statements
JS Math
W3Schools Home
JS Date
This section contains a complete reference of:
JS Array
JS Boolean
All built-in JavaScript objects
All browser objects
All HTML DOM objects
JS RegExp
JS Global
Browser BOM
Window
Navigator
Screen
History
Location
HTML DOM
DOM Document
DOM Elements
DOM Attributes
DOM Events
HTML Objects
<a>
<abbr>
<address>
<area>
<article>
<aside>
<audio>
<b>
<base>
<bdo>
<blockquote>
<body>
<br>
<button>
<canvas>
JavaScript Reference
The references describe the properties and methods of all JavaScript objects, along
JavaScript
JavaScript
JavaScript
JavaScript
JavaScript
JavaScript
JavaScript
JavaScript
JavaScript
JavaScript
Strings
Numbers
Operators
Statements
Math Object
Date Object
Arrays
Booleans
RegExp Object
Global Object
Browser Objects Reference
The references describe the properties and methods of each object, along with exam
Window object
Navigator object
Screen object
History object
Location object
HTML DOM Reference
The references describe the properties and methods of the HTML DOM, along with e
HTML Document
http://www.w3schools.com/jsref/default.asp
<caption>
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<footer>
<form>
<head>
<header>
<hgroup>
<h1> - <h6>
<hr>
<html>
<i>
<iframe>
<img>
<ins>
<input> button
<input> checkbox
<input> color
<input> date
<input> datetime
<input> datetime-local
<input> email
<input> file
<input> hidden
<input> image
<input> month
<input> number
<input> password
<input> radio
<input> range
<input> reset
<input> search
<input> submit
<input> text
<input> time
HTML Element
HTML Attributes
HTML Events
HTML Element Objects Reference
The references describe the properties and methods of each HTML object, along wit
Anchor object
Abbreviation object
Address object
Area object
Article object
Aside object
Audio object
Bold object
Base object
Bdo object
Blockquote object
Body object
BR object
Button object
Canvas object
Caption object
Cite object
Code object
Column object
ColumnGroup object
Datalist object
Del object
Details object
DFN object
Dialog object
Div object
DList object
DT object
Emphasized object
Embed object
Fieldset object
Figcaption object
Figure object
Footer object
Form object
Head object
Header object
Heading object
HGroup object
HR object
HTML object
Italic object
IFrame object
Image object
Ins object
Input Button object
Input Checkbox object
Input Color object
Input Date object
Input Datetime object
Input Datetime Local object
http://www.w3schools.com/jsref/default.asp
<input> url
<input> week
<kbd>
<keygen>
<label>
<legend>
<li>
<link>
<map>
<mark>
<menu>
<menuitem>
<meta>
<meter>
<nav>
<object>
<ol>
<optgroup>
<option>
<p>
<param>
<pre>
<progress>
<q>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<td>
<th>
<tr>
<textarea>
<time>
<title>
<track>
<u>
<ul>
<var>
<video>
Input Email object
Input File object
Input Hidden object
Input Image object
Input Month object
Input Number object
Input Password object
Input Radio object
Input Range object
Input Reset object
Input Search object
Input Submit object
Input Text object
Input Time object
Input URL object
Input Week object
Kbd object
Keygen object
Label object
Legend object
Li object
Link object
Map object
Mark object
Menu object
MenuItem object
Meta object
Meter object
Nav object
Object object
Ol object
OptionGroup object
Option object
Paragraph object
Parameter object
Pre object
Progress object
Quote object
S object
Samp object
Script object
Section object
Select object
Small object
Source object
Span object
Strong object
Style object
Subscript object
Summary object
Superscript object
Table object
TableData object
TableHeader object
TableRow object
Textarea object
Time object
Title object
Track object
http://www.w3schools.com/jsref/default.asp
Underline object
Ul object
Variable object
Video object
W3Schools Home
Next Refere
Top 10 Tutorials
Top 10 References
Top 10 Examples
Web Certifi
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
XML Tutorial
SQL Tutorial
PHP Tutorial
ASP.NET Tutorial
jQuery Tutorial
Angular Tutorial
Bootstrap Tutorial
HTML Reference
CSS Reference
JavaScript Reference
Browser Statistics
HTML DOM
XML DOM
PHP Reference
jQuery Reference
HTML Colors
HTML Character Sets
HTML Examples
CSS Examples
JavaScript Examples
HTML DOM Examples
PHP Examples
jQuery Examples
XML Examples
XML DOM Examples
ASP Examples
SVG Examples
HTML Certific
HTML5 Certif
CSS Certifica
JavaScript Ce
jQuery Certif
PHP Certifica
XML Certifica
REPORT ERROR | HOME | TOP | PRINT | F
W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. T
constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read a
privacy policy. Copyright 1999-2014 by Refsnes Data. All Rights Reserved.
HOME
HTML
CSS
JAVASCRIPT
SQL
PHP
JQUERY
ANGULAR
BOOTSTRAP
XML
JavaScript Reference
Overview
JavaScript
JS String
JS Number
JS Operators
JavaScript String Reference
JS Statements
JS Math
Previous
http://www.w3schools.com/jsref/default.asp
ASP.NET
MORE...
JS Date
JS Array
JS Boolean
JS RegExp
JS Global
Browser BOM
Window
Navigator
JavaScript Strings
A JavaScript string stores a series of characters like "John Doe".
A string can be any text inside double or single quotes:
var carname = "Volvo XC60";
var carname = 'Volvo XC60';
Screen
History
Location
String indexes are zero-based: The first character is in position 0, the second in 1,
For a tutorial about Strings, read our JavaScript String Tutorial.
HTML DOM
DOM Document
DOM Elements
DOM Attributes
DOM Events
HTML Objects
<a>
<abbr>
<address>
String Properties and Methods
Primitive values, like "John Doe", cannot have properties or methods (because they
But with JavaScript, methods and properties are also available to primitive values,
primitive values as objects when executing methods and properties.
String Properties
<area>
Property
Description
<article>
constructor
Returns the string's constructor function
length
Returns the length of a string
prototype
Allows you to add properties and methods to an object
<aside>
<audio>
<b>
<base>
<bdo>
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<div>
<dl>
<dt>
String Methods
Method
Description
charAt()
Returns the character at the specified index (position)
charCodeAt()
Returns the Unicode of the character at the specified in
concat()
Joins two or more strings, and returns a new joined str
fromCharCode()
Converts Unicode values to characters
indexOf()
Returns the position of the first found occurrence of a
lastIndexOf()
Returns the position of the last found occurrence of a s
localeCompare()
Compares two strings in the current locale
match()
Searches a string for a match against a regular expres
replace()
Searches a string for a specified value, or a regular exp
string where the specified values are replaced
<em>
http://www.w3schools.com/jsref/default.asp
<embed>
search()
Searches a string for a specified value, or regular expr
of the match
slice()
Extracts a part of a string and returns a new string
split()
Splits a string into an array of substrings
substr()
Extracts the characters from a string, beginning at a sp
through the specified number of character
<h1> - <h6>
substring()
Extracts the characters from a string, between two spe
<hr>
toLocaleLowerCase()
Converts a string to lowercase letters, according to the
toLocaleUpperCase()
Converts a string to uppercase letters, according to the
toLowerCase()
Converts a string to lowercase letters
toString()
Returns the value of a String object
toUpperCase()
Converts a string to uppercase letters
trim()
Removes whitespace from both ends of a string
valueOf()
Returns the primitive value of a String object
<fieldset>
<figcaption>
<figure>
<footer>
<form>
<head>
<header>
<hgroup>
<html>
<i>
<iframe>
<img>
<ins>
<input> button
<input> checkbox
<input> color
<input> date
<input> datetime
<input> datetime-local
<input> email
<input> file
<input> hidden
<input> image
<input> month
<input> number
<input> password
String HTML Wrapper Methods
The HTML wrapper methods return the string wrapped inside the appropriate HTML
These are not standard methods, and may not work as expected in all browsers.
Method
Description
<input> range
anchor()
Creates an anchor
<input> reset
big()
Displays a string using a big font
blink()
Displays a blinking string
bold()
Displays a string in bold
fixed()
Displays a string using a fixed-pitch font
fontcolor()
Displays a string using a specified color
fontsize()
Displays a string using a specified size
italics()
Displays a string in italic
<link>
link()
Displays a string as a hyperlink
<map>
small()
Displays a string using a small font
strike()
Displays a string with a strikethrough
sub()
Displays a string as subscript text
sup()
Displays a string as superscript text
<input> radio
<input> search
<input> submit
<input> text
<input> time
<input> url
<input> week
<kbd>
<keygen>
<label>
<legend>
<li>
<mark>
<menu>
<menuitem>
<meta>
<meter>
<nav>
http://www.w3schools.com/jsref/default.asp
<object>
<ol>
<optgroup>
Previous
<option>
<p>
<param>
<pre>
<progress>
<q>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<td>
<th>
<tr>
<textarea>
<time>
<title>
<track>
<u>
<ul>
<var>
<video>
Top 10 Tutorials
Top 10 References
Top 10 Examples
Web Certifi
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
XML Tutorial
SQL Tutorial
PHP Tutorial
ASP.NET Tutorial
jQuery Tutorial
Angular Tutorial
Bootstrap Tutorial
HTML Reference
CSS Reference
JavaScript Reference
Browser Statistics
HTML DOM
XML DOM
PHP Reference
jQuery Reference
HTML Colors
HTML Character Sets
HTML Examples
CSS Examples
JavaScript Examples
HTML DOM Examples
PHP Examples
jQuery Examples
XML Examples
XML DOM Examples
ASP Examples
SVG Examples
HTML Certific
HTML5 Certif
CSS Certifica
JavaScript Ce
jQuery Certif
PHP Certifica
XML Certifica
REPORT ERROR | HOME | TOP | PRINT | F
W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. T
constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read a
http://www.w3schools.com/jsref/default.asp
privacy policy. Copyright 1999-2014 by Refsnes Data. All Rights Reserved.
http://www.w3schools.com/jsref/default.asp