The following flow chart explains a switch-case statement works:
the browser manipulates a page.
When a page loads, when a user clicks a button, pressing any key, closing a window,
resizing a window, etc.
onclick Event Type This is the most frequently used event type which occurs when a user clicks
the left button of his mouse.
Your server sends some data to the visitor's browser in the form of a cookie.
The browser may accept the cookie. If it does, it is stored as a plain text record on the
visitor's hard drive. Now, when the visitor arrives at another page on your site,
the browser sends the same cookie to the server for retrieval. Once retrieved, your
server knows/remembers what was stored earlier.
Cookies are a plain text data record of 5 variable-length fields:
Expires: The date the cookie will expire. If this is blank, the cookie will expire when
the visitor quits the browser.
Domain: The domain name of your site.
Path: The path to the
directory or web page that set the cookie. This may be blank if you want to retrieve the cookie
from any directory or page.
Secure: If this field contains the word "secure", then the cookie may
only be retrieved with a secure server. If this field is blank,
no such restriction exists.
Name=Value: Cookies are set and retrieved in the form of key-value pairs.
The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this.
document.cookie = "key1=value1;key2=value2;expires=date";
This code can be called automatically upon an event or simply when the
user clicks on a link.
If you want to refresh a web page using a mouse click,
then you can use the following code:
Alert Dialog Box
An alert dialog box is mostly used to give a warning message to the users
Confirmation Dialog Box A confirmation dialog box is mostly used to take user's
consent on any option. It displays a dialog box with two buttons: OK and Cancel.
Prompt Dialog Box
The prompt dialog box is very useful when you want to pop-up a text box to get user input.
Thus, it enables you to interact with the user. The user needs to fill in the field and then click OK.
This operator specifies an expression to be evaluated without returning a value.
implement this functionality using the print function of window object.
< input type="button" value="Print" onclick="window.print()" / >
Objects are composed of attributes. If an attribute contains a function, it is considered to be a method of the object,
otherwise the attribute is considered a property.
The Number object represents numerical date, either integers or floating-point numbers. In general, you do not need to worry
about Number objects because the browser automatically converts number literals to instances of the number class.
The Boolean object represents two values, either "true" or "false".
data type with a number of helper methods.
The Array object lets you store multiple values in a single variable. It stores a fixed-size sequential collection of elements
of the same type. An array is used to store a collection of data, but it is often more
useful to think of an array as a collection of variables of the same type.
The math object provides you properties and methods for mathematical constants and functions.
Unlike other global objects, Math is not a constructor. All the properties and methods of Math
are static and can be called by using Math as an object without creating it.
Thus, you refer to the constant pi as Math.PI and you call the sine function as Math.sin(x), where x is the method's argument.
A regular expression is an object that describes a pattern of characters.
define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on text.
Every web page resides inside a browser window which can be considered as an object.
A Document object represents the HTML document that is displayed in that window.
The Document object has various properties that refer to other objects which allow access to and modification of document content.