Ticker

6/recent/ticker-posts

JavaScript (Introduction)

INTRODUCTION TO JAVASCRIPT

JavaScript created by "Brendan Eich" at Netscape (Netscape is an American Company) and introduced it, in December-1995 with name of LiveScriptbut and after a short while it renamed as "JavaScript"

Now JavaScript became the most popular web programming language and it used to developed dynamic several types of web-pages.


FEATURES OF JAVASCRIPT

1. Client side language: JavaScript is an example of client side scripting language, 

2. Lightweight: Its a lightweight programming language that is interpreted by the web browser Such (Internet Explorer, Mozilla Firefox, Google Chrome)


3. Less secure: JavaScript is an example of client side programming language therefore its less secure than compare of server side programming languages such PHP, ASP.NET, etc. 


4. Easily embed in HTML program: JavaScript codes can be easily embed in any HTML program and entire java script code written in <script> tag.



JAVASCRIPT  PROGRAM EXAMPLES

<html>

<title> Print simple text by JavaScript function </title>

<|-- Define java script function --|>

<script>

function msg()

{

document.write("Hello world");

}

</script>

<body>

<form>

<input type="button" value="Click me" onclick="msg()">

</form>

</body>

</html>


PROGRAM EXPLANATION
In the above code <script> define java script, 'function' is a keyword in java script that is used to define a user define function and 'msg()' is function's name.


'document.write' is used to print any given statement on output window and 'Hello world' its argument which print on output window after run this code. 


'onclick' is a JavaScript even which attach with a html button control, so as we will click on this button the 'msg()' function execute.







Post a Comment

0 Comments