Script means screen play (or Play). A script is a small program (code). It can be inserted into html document to perform a specific task (action). A web page may contain scripts.
Scripts are divided into two categories:
- Client-side scripts
- Server-side scripts
Client-side scripts are often embedded within an html document. In addition, client-side scripts may also be stored on the server in a separate file. This file is loaded into the client computer, when the user send a request to the web server. A specific script stored in a separate file can be called for execution in the html page with the reference to script name (such as name of function). The web browser executes the script and then displays the visible output of the script.
A script that is executed on the web server is called server-side script. The web server also has a script interpreter. It interprets (translates) the script code stored on the server and generates html code dynamically. The web server then sends this code to the web client (internet browser).
The advantage of the server-side script is that it allows you to access the server resources. For example, you can write and read data to and from the database stored on the server. You can also access the file system of server. Similarly, you can access a mail server in order to receive or send e-mail.
Easy to Learn:
Easy to Debug and Test:
Embedded within html:
React to Events:
Input Data Validation:
Detecting Visitor’s Browser:
The main purpose of cookies it to identify users and possibly prepare customized web pages for them. When you enter a website using cookies, you may be asked to fill out a form providing such information as your name and interests. This information is packaged into a cookie and sent to your web browser, which stores it for later use. The next time you go to the same website, your browser will send the cookie to the web server. The server can use this information to present you with custom web pages. So, for example, instead of seeing just a generic welcome page you might see a welcome page with your name on it something like: “welcome to Programming Digest”.
Rules of Writing Program Statements:
- Variables must be defined before they are used in the code.
“Js_code.js file code”
“demo.html file code”
Example how to use confirm dialog box in Javasrcipt and html:
If you click on ok the following message will be displayed
And if click on cancel then it will show the following