Tuesday, October 21, 2014

Basics of Javascript , javascript v/s java ,vbscript, script tag , noscript tag , implementation of javascript

Objects,Properties,Value,Methods:


Objects:
        - A programing function that models the charachteristics of abstract or
Real “object” using classes.
Properties:
        - A descriptive charachteristics of an object.
Value:
        - The specific quality to the property of an object.
Methods:
        - An action that can be performed by an object.

 

Javascript AND Java:

JavaScript

JAVA

Interpreted (not compiled) by client.

Compiled on server before execution on client.

Variable data types not declared (loose typing).

Variable types must be declared
(strong typing ).

Dynamic binding; object references checked at run time.

Static binding; object references must exist at compile time

Secure; cannot write to hard disk.

Secure; cannot write to hard disk

Code integrated with and embedded in HTML.

 

 

JavaScript and VBScript:

  - JavaScript and VBScript are scripting languages that have similar purposes.
Both extend the capabilities of static Web pages.
- JavaScript was the first scripting language developed for Web page design.
- It has been incorporated into Netscape Navigator browsers since version 2.0.
- VBScript is the Microsoft Web-scripting language, based on the powerful and popular      
Visual Basic language.
- JavaScript is a strong object-based language that relies, for much of its functionality,
on objects and their attendant methods and properties.

V        

<SCRIPT> Tag:

  • The HTML <script> tag is used to insert a JavaScript into an HTML page.
  • Inside <script> tag type attribute is used to specify the scripting language.
  • JavaScript can write into two sections between <HEAD> tag or between <BODY> tag.
  • If user writes code in <body> section then JavaScript code will be executed immediately after the page has been load.
  • If user writes code in <head> section then JavaScript code will be executed depends on user’s requirement.

Syntax:
<HTML>
<BODY>
<SCRIPT TYPE = “TEXT/JAVASCRIPT”>
                                     . . . .                                                      
      All JavaScript code will </SCRIPT>                                                                 
</HTML>

Attributes of <SCRIPT> Tag:

1)language:This indicates the scripting language of the code as specifier.

                   EX:<script language=”javascript”>

2)type: This indicates the scripting language of the code as content - type.

                  EX:<script type=”text/javascript”>

3)src:Points to an external resource where the script code is declared.

The <NOSCRIPT> Tag.

  • You should be aware that your users may have older browsers that do not support JavaScript, or may disable execution of JavaScript code within their browsers. If so, you can use the HTML <NOSCRIPT> tag to render content for these users.

Example:
<script type="text/javascript">
<h1>This is a SCRIPT TAG Example</h1>
</script>
<noscript>
<h1>This is a NOSCRIPT TAG Example</h1>
</noscript>

Where to Put the JavaScript?
- JavaScripts in a page will be executed immediately while the page loads into the browser.  
- This is not always what we want. Sometimes we want to execute a script when a page  
loads, other times when a user triggers an event.

 Scripts in the head section: Scripts to be executed when they are called, or when an
event is triggered, go in the head section.
<html>
<head>
<script type="text/javascript">
document.write("Shree Solution Junagadh");
</script>
</head>
</html>

Scripts in the body section: Scripts to be executed when the page loads go in the body
section. When you place a script in the body section it generates the content of the page.
<html>
<head>
<script type="text/javascript">
document.write("Shree Solution Junagadh");
</script>
</head>
</html>

Scripts in both the body and the head section: You can place an unlimited number of
scripts in your document, so you can have scripts in both the body and the head section.
<html>
<head>
<script type="text/javascript">
document.write("Shree Solution Junagadh");
</script>
</head>
<body>
<script type="text/javascript">
document.write("Shree Solution Junagadh");
</script>
</body>

</html>


3 comments:

Kale Co Jakim said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

tamizh said...

I appreciate that you produced this wonderful article to help us get more knowledge about this topic.
I know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!



Selenium training in bangalore
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training

siva said...

All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information,
I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
Java training in Btm layout
Java training in Jaya nagar
Java training in Electronic city
Java training in Chennai
Java training in USA