What Is Javascript and How To Use It?


Today we will discuss about “JavaScript” which is not so familiar to most of the bloggers. Because every blogger thinks that it is very hard to understand such kind of scripting language but actually JavaScript is an easy-to-use programming language that can be embedded in the header of site or blog. It can enhance or improves the interactive  and dynamics features of our website or blog by allowing us to perform calculations, validate forms, add special effects, customize graphics selections, create security passwords etc. It is as powerful as any other scripting languages.

History of Javascript -

Originally JavaScript was developed by Netscape as the name of “Live Script”. These scripts were used to enhance and improve the functionality of the web pages by providing some HTML level interaction for the user. Later, live script was used as a communication medium between HTML documents and Java applets. In December 1995, Netscape and Sun joined hands and renamed the language as JavaScript.

Also Read :- How To Add jQuery In Blogger And Blogspot Blogs

Using JavaScript in and HTML page:-

JavaScript’s are written as part of HTML documents. The Browser software of the user does the interpretation of the JavaScript commands just as it does with HTML tags. Browsers must be equipped with JavaScript interpreters to take advantage of the scripts in web pages but don’t get confused cause now days almost every browser is equipped with JavaScript interpreters or any Java compatible browser will also be able to interpret JavaScript scripts. JavaScript can be used in following situations:

  • For Designing web pages to respond to user interaction with form or any other data entry elements.
  • Importing and exporting data from databases and providing friendly interface to data.
  • It also helps in processing the data on the client side before submitting it to the server.

Adding JavaScript to an HTML page or in header:-

JavaScript can be inserted into HTML pages between <head> and </head> tags or <body> and </body> tags. JavaScript begins with a <script> tag and ends with </script> tag followed by <script language="javascript"> to identify the scripting language for the browser. The general structure of the JavaScript code in an HTML page is :
<script language="javascript">
<!--
Statements
- ->
</script>
Note the use of HTMl comment tags, <! - - and - ->.If the page containing the script is used in a browser that is not compatible with scripting languages. The script statements are not executed.

Using SRC attribute within <script>

The SRC attribute allows us to load JavaScript from a separate file on the server. Eternal script files cannot contain HTML markup and must be saved as standard ASCII texts with .js extension. We can point to the script file using a relative URL such as
 <script language="javascript" src="myscript.js">
</script>
We can also use absolute URL path such as:
<script language="javascript" src="http://www.sorabloggingtips.com/myscript.js">
</script>

Conclusion

Congrats !! You have made it. now you have learned that What Is Javascript and How To Use It? Visit your blog and check the awesome customization live in action, hope you liked this tutorial, if you enjoyed then please share it with your friends, we are working hard to develop more such awesome tutorials please stay tuned with Us.

Comments