Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   An indroduction to javascript (http://www.go4expert.com/forums/indroduction-javascript-t22085/)

unni krishnan.r 13May2010 07:14

An indroduction to javascript
 
Indroduction

JavaScript is one of the most used Web based language.JavaScript (js) is the continuation of HTML (Hyper text markup language).
There are many uses and (of course abuses) of javascript language.Here are few things that you may or may not seen in your web serfing areas
  • Clocks
  • Mouse trailers
  • Drop down menus
  • Alert messages
  • Popup windows
  • HTML from data validation
These things are done basically with the help of java script
Writing javascript

Javascript program usually written on Specially text editors.Some kind of text editors are specialy build for writting HTML languages.
Usually notepad,word pad are used in writing Javascript enabled files.Some text editors like G-edit are used in linux platform.
After writing the HTML/javascript based files you must remember to save the text as HTML
ie If your HTML file name is “index” save it as index.html.Viewing html based programmes is not a difficult task. You must have a web browser such as Windows explorer,Mozilla firefox ect
So first up all lets look into a sample html programm
Quote:

<html> <head></head> <body> Hello world </body> </html>
the letters are not case sensitive you can type your program in Upper case or in lower case.
Output of programm will be:-Hello world
Exploring javascript
Let’s find out how it works
  • There will be one opening tag (ie) <html> is a closing tag and </html> will be its closing tag (you will pronounce it as slash html).
  • JavaScript is an additional script used in html. So you must specify that you are using an additional script for that you must use “<sript type=”text/javascript”>” N.B if you are using other scripts you must denote it
  • Document.write(“your text here ”) is a specific tag used in JavaScript to print texts used as input.
  • You must close your all tabs like </script>,</head>,and </html>
In some browsers JavaScript may not be enabled. You must enable the JavaScript

satyedra pal 13May2010 10:34

Re: An indroduction to javascript
 
JavaScript is a scripting language used to make interactiveweb pages .It also known as LiveScript,
JavaScript developed by Netscape with the trademark of sunmicrosystem.
In Javascript we uses functions and the Functions can be defined in the <head> section and in the <body> section of a HTML document.
Javascript provide the following way for implement.

Code:

<html>
<head>
<script type="text/javascript">
function show()
{
alert("welcome");
}
</script>
</head>

<body>
<form>
<input type="button" value="Click " onclick="show()" >
</form>
</body>
</html>


unni krishnan.r 13May2010 11:00

Re: An indroduction to javascript
 
IF COMMENT IN JAVASCRIPT
usualy if and if else comments are used in c/c++ languages the if statement is away to make desitions based on variable or some type of data
if programm in javascript
Quote:

<html>
<head>
<script type="text/javascript">
var a-10 //var = variable
if (a=7)
document.write("you are very lucky")
else
document.write("unlucky")
</script>
</head>
</html>
Since a=10 and its not equal to 7 output will be unlucky

unni krishnan.r 13May2010 11:02

Re: An indroduction to javascript
 
Quote:

Originally Posted by satyedra pal (Post 68047)
JavaScript is a scripting language used to make interactiveweb pages .It also known as LiveScript,
JavaScript developed by Netscape with the trademark of sunmicrosystem.
In Javascript we uses functions and the Functions can be defined in the <head> section and in the <body> section of a HTML document.
Javascript provide the following way for implement.

Code:

<html>
<head>
<script type="text/javascript">
function show()
{
alert("welcome");
}
</script>
</head>

<body>
<form>
<input type="button" value="Click " onclick="show()" >
</form>
</body>
</html>


thanks for the History yaar

unni krishnan.r 13May2010 11:50

Re: An indroduction to javascript
 
Loops
Loops are text printing from an integer to its next number eg 1 to 100
while loop
There are two parts to javascript while loop
*The conitional statements must be true for while loop's code to be executed
*The while loop codes that condain curley brases {} Will be executedif condition is true
When while loop begins in javascript interpreter cheakes cheaks the condition statement is true then its executed[QUOTE]<html>
Quote:

<script type="text/javascript">
var a=0
var c="</br>"
Document.write("While loop begining")
document.write(c)
While (a<=10)
{
document.write(a)
document.write(c)
a++
}
</script>
</body>
</html>
Out put
Quote:

1
2
3
4
5
6
7
8
9
10


All times are GMT +5.5. The time now is 12:34.