JavaScript Basic Part-1




What is Java Script ?

1. Java Script is a Scripting language Which is designed To Add Interactivity

    To HTML page.

2. Java Script Code Can We Directly Embedded to The HTML Code.

3. It is a Interpreted Language (JavaScript Code Can be Execute Without

    Preliminary Complication).

4. JavaScript Provides The Dynamic Text on your HTML Page.

Uses of JavaScript

There are a lots of Uses of the JavaScript Code . In  our day Today life ,

JavaScript Code is Playing a Important Role . Some of Them are Giving

Under The Following Points..

1. Validation of the Form

With the use of java Script Code We can Validate The Application Form.

before Submitting The Code , We can Check Whether Input Fields have

a Correct and Proper data Type Value or not .

2. Identification of browser

Name , Version and other Details of the browser , used by the user , We can

Easily get with the Java Script Code.

3. Create Cookies

Cookies Means , Storing The information on the Visitor System Like

Password, User name , Email-Id , DOB and Other Information of

The User.

4. User Search Interest

Java Script Code also helpful to get the user Search interest , For Particular

User , Which type of Search Results he Want May be Study Related ,

Entertainment , Sports , News etc

Put JavaScript Code into HTML Page

you Can put your JavaScript Code inside  head and body Section . but

Generally and For our Comfort We Use JavaScript Code inside The Head

Section . Use <script> Tag to Place the JavaScript Code.

<script> Tag :

<script > Tag Tells to the browser That Which Scripting Language you are

using in your HTML Document LIke JavaScript or Vbscript. <script> tag is

not a Empty tag so It have Corresponding Closing Tag.

Ex :

<script type="javascript">
.....
Your JavaScript Code
.....
</script>

External JavaScript Code

you can use a External JavaScript Code inside The <script> Tag . if you Want

To Use External JavaScript Code than Use The src attribute in <script tag>

Ex :

<script type="javascript" src="URL_of_your_external_javascript_File">
.....
Your JavaScript Code
.....
</script>

Now , You put your <script> tag inside The head section

<html>
<head>
<title> First Java Script Program </title>
<script type="text/javascript">
.....
Your JavaScript Code
.....
</script>
</head>

<body>
.....
</body>
</html>

JavaScript Variable

In JavaScript , you Can declare the variable with and without use of var .

Ex :

var name="i-World-Tech"
      or
name="i-World-Tech"


JavaScript Have a Three Types of the pop up boxes .

1. Alert Box
2. Confirm Box
3. Prompt Box

Syntax :

Alert Box
alert("Here , Enter Your Text")

Confirm Box
confirm("Enter your Text")

Prompt Box
prompt("Please Enter your name" , "Enter your name here")


JavaScript Function

Syntax :

To Define The Function in JavaScript Syntax is :

Function Function_Name(Argument(Optional))
{
Function_body(or Code)
}

You Can Call The JavaScript Function Form Any Where.

Ex :

Function welcome(){
alert("WELCOME..MY FIRST JAVASCRIPT PROGRAM");
}

Hello JavaScript Program

Here , is the Simple Code of the Hello JavaScript Program using the Alert box.

 <html>
<head>
<title> First Javascript Program </title>
<script type="text/javascript">
alert("WELCOME..MY FIRST JAVASCRIPT PROGRAM");
</script>
</head>
<body>
<h1>
Hello Java Script...!!! </h1>
</body>
</html>  

Thank You To All My Reader

Related Post








8. JDK 8


Comments