what is Javascript?an Introduction to beginners



what is javascript?
Javascript  is  a  scripting  language  produced  by  Netscape  which can be used in HTML  Web pages .Javascript can run in most of all modern browsers.With the help of javascript we can change or remove HTML elements in the page.Also we can able to change in css styles using javascript.

javascript

What is a scripting language?


A scripting language is an interpreted programming  language .Interpreted programming language is a language which execute instructions directly without compiling a program .With the interpreted programming language , the scripting language can execute the task with automation.

What is the difference between scripting language and programmig language?

Scripting language  - A scripting language is an interpreted programming  language which execute instructions directly without compiling a program
the source code is delievered to runtime environment
Programmig language-A programmig language  is used to write  computer programs .Some computer programs are applications ,servers and more.It compiles the program .Examples are c and C++.the source code is not delievered to runtime environment .Because first it will compile the source code.


Syntax for javascript:


<script>
Write the javascript code in betwee these script .
</script>


Example:

Open notepad copy and paste below code and save as “index.html” . Open with index.html with a browser.

<script>
document.write("Hello world");
</script>

javascript-code-helloworld

What will happen if we not use double quotes for hello world?




Example:

<script>
document.write(Hello world);
</script>
javascript-code-example

Yes we should follow some rules  while we writing javascripting codes.There are also some javascript reserved words and you should not use as variables ,functions and more.

What is document.write()?

document.write() is used to display strings[(i.e)words(or) texts  like Hello world] like we use html tags to display texts.

Why should we use document.write() only for testing not for websites?

Use the below code in notepad and save as index.html.


<html>
<button onclick="document.write(2 + 4)">Try
it</button>
</html>

Now you will have the button try it .When you click the try it button you will get  output 6.You got the output 6 but now you can’t return to try it button .And so it is not good thing for real time websites and also not good for users who are visiting websites. So it is recommended you can use document.write() for some practice and understanding javascript but it is not good for websites. Then how to make best way to to use javascript to users.It will be shared in another post.

Sample animated gif to describe document.write()

document-javascript


Uses of javascript


We can validate html form.
Able to make awesome hover effects.
Able to make beautiful animations.
Print Friendly and PDF
SHARE

About me

Hi. I am interested in blogging.And sometimes play with webdesign,web development,domain sale,designing logo and more.

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment

Pages