Skip to main content

UNDERSTANDING JAVA SCRIPT



Advantage of Using JavaScript

1. Embedded with in HTML: JavaScript is embedded with in a HTML. It does not require any
separate editor for programs to be written /edited/compiled. Like HTML JavaScript can be
written in simple editor such as HTML.

2. Improved Performance: JavaScript is written with the HTML tags and is interpreted by the
browser. This minimizes storage requirement on the web server and download time for the
client.

3. Minimal Syntax: The rules for the syntax are simple and applications can be quickly
built.

4. Designed for Simple Programs: Simple small programs can be easily written and
implemented using JavaScript. Such programs can be easily integrated in a webpage.

5. An Interpreted Language: JavaScript is an interpreted language. It does not require a
compilation steps. The syntax is interpreted by the browser just as it interprets HTML
tags.

6. Good Programming Constructs: Like other programming languages JavaScript support
facilities like looping, branching, condition checking etc...

7. Designed for Programming Events

8. Easy Debugging: Since JavaScript is an interpreted language easily to debug it line by
line. Also errors are listed as they are encountered.

9. Platform Independence: JavaScript completely independent of the hardware being used. It
just needs a proper installation of browser for its functioning.

10. JavaScript gives HTML designers a programming tool - HTML authors are normally not
programmers, but JavaScript is a scripting language with a very simple syntax! Almost
anyone can put small "snippets" of code into their HTML pages.

11. JavaScript can put dynamic text into an HTML page - A JavaScript statement like this:
document.write("

" + name + "

") can write a variable text into an HTML page.

12. JavaScript can react to events - A JavaScript can be set to execute when something
happens, like when a page has finished loading or when a user clicks on an HTML element.

13. JavaScript can read and write HTML elements - A JavaScript can read and change the
content of an HTML element.

14. JavaScript can be used to validate data - A JavaScript can be used to validate form data
before it is submitted to a server. This saves the server from extra processing.

15. JavaScript can be used to detect the visitor's browser - A JavaScript can be used to
detect the visitor's browser, and - depending on the browser - load another page
specifically designed for that browser.

16. JavaScript can be used to create cookies - A JavaScript can be used to store and
retrieve information on the visitor's computer

Similarity with Java and JavaScript

You may get confused between Java and Java Script due to similarity in their names. It is important to understand that Java and JavaScript are two completely different languages both in concept and design. Java is a powerful language developed by Sun Microsystems) as complex as C or C++.

Writing Java script in a webpage

JavaScript syntax is embedded in a HTML file. As browser reads and interprets a HTML file similarly browser uses its in built JavaScript engine to interpret the JavaScript code. Thus all JavaScript code needs to be includes as an integral part of a HTML document. The major question that arises from this discussion is that how browser recognizes a JavaScript code. The browser gets the information about the JavaScript code through the



The type attribute of the Script tag defines the language and format being used. The value “text/javaScript” shows that the text format and javaScript language will be used in the script.

Check out the following JavaScript code embedded in a HTML document.







In the above example document.write is a standard JavaScript command that is used for writing output to a page. It is through the document.write command written between the tags browser will recognize that it is a JavaScript command and will write Learning JavaScript! on the web page as follows:


You must be wandering what will happen in case you write the JavaScript code without writing any HTML tag. In that case the browser will treat the document.write("Learning JavaScript’) command as pure text, and will just write the entire line on the page.

E.g. Suppose you entered following code in a webpage:



document.write("Learning JavaScript!");


On running the script in the browser you will get the following output;

Note: You can use simple editor like Notepad for writing the webpage and you need to save the webpage as a HTML file (e.g. trial.html)

Comments

Popular posts from this blog

Advantages and Disadvantages of EIS Advantages of EIS Easy for upper-level executives to use, extensive computer experience is not required in operations Provides timely delivery of company summary information Information that is provided is better understood Filters data for management Improves to tracking information Offers efficiency to decision makers Disadvantages of EIS System dependent Limited functionality, by design Information overload for some managers Benefits hard to quantify High implementation costs System may become slow, large, and hard to manage Need good internal processes for data management May lead to less reliable and less secure data

Inter-Organizational Value Chain

The value chain of   a company is part of over all value chain. The over all competitive advantage of an organization is not just dependent on the quality and efficiency of the company and quality of products but also upon the that of its suppliers and wholesalers and retailers it may use. The analysis of overall supply chain is called the value system. Different parts of the value chain 1.  Supplier     2.  Firm       3.   Channel 4 .   Buyer

Big-M Method and Two-Phase Method

Big-M Method The Big-M method of handling instances with artificial  variables is the “commonsense approach”. Essentially, the notion is to make the artificial variables, through their coefficients in the objective function, so costly or unprofitable that any feasible solution to the real problem would be preferred, unless the original instance possessed no feasible solutions at all. But this means that we need to assign, in the objective function, coefficients to the artificial variables that are either very small (maximization problem) or very large (minimization problem); whatever this value,let us call it Big M . In fact, this notion is an old trick in optimization in general; we  simply associate a penalty value with variables that we do not want to be part of an ultimate solution(unless such an outcome is unavoidable). Indeed, the penalty is so costly that unless any of the  respective variables' inclusion is warranted algorithmically, such variables will never be p