











































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












































JAVASCRIPT and WHAT CAN IT DO Most popular scripting language on the internet and works in all major browsers such as internet explorer Usually embedded directly into web pages It is an interpreted language It gives HTML designers a programming tool. It can put dynamic text into an html page It can react to events It can read and write HTML elements Can be used to validate data. Can be used to create computer
Speed
being client side, javascript is very fast because any code functions can be run immediately instead of having to contact to the server and wait for an answer. Simplicity
javascript is relatively simple to learn and implement. Versatility
javascript plays nicely with other languages and be used in a huge variety of applications. Server Load
being client –side reduces the website server. Easy to debug and testing No special editor is required for it.
**_To insert a javascript into an HTML page , we use the
< script type=“text/JavaScript”> document.write(“Hello World!”);
Single line comment start with
Example //write a heading Javascript multiple line comments start with
and end with/. Example /the code will write one heading and two pragraphs.*/
Arithmetic operators Assignment operators Comparison operators Logical operators Conditional operator
OPERATOR EXAMPLE SAME AS RESULT = X=Y X= += X+=Y X=X+Y X= ‐ = X ‐ =Y X=X ‐ Y X= = X=Y X=X*Y X= /= X/=Y X=X/Y X= %= X%=Y X=X%Y X=
Comparison Operators : X=
An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click “OK” to proceed. Syntax
alert(“sometext”);
confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either
or “cancel’ to proceed. If the user clicks
the box returns true. If the user clicks “cancel”, the box returns false. Syntax
confirm(“sometext”);
function contains a code that will be executed by an event or by a call to the function. We may call a function from anywhere with in a page Functions can be defined both in the
and in the
section of a document Syntax
Function function name(var1, var2…varx) { Some code }