Skip to main content

Browser support to JavaScript



Browser support to JavaScript

It is possible that a browser do not support JavaScript (generally older versions of the browsers). In such cases JavaScript will be displayed as the content of the webpage as explained above. To prevent them from doing this and as a part of the JavaScript standard you should use the HTML comment tag to "hide" the JavaScript. For this you need to add an HTML comment tag (end of comment) after the last JavaScript statement.

E.g.







Note: In the above example the two forward slashes at the end of comment line (//) are the JavaScript comment symbol. This prevents JavaScript from executing the --> tag. In case browser does not support JavaScript, the JavaScript code will not be displayed in the webpage as it is written inside the HTML comment tag.

Using JavaScript and HTML together

As you have seen that you can easily embedded JavaScript in a HTML document. Whenever you need to write JavaScript code you need to use



In the above example you find that the text to be written by the javaScript code is formatted using the header tags

and

.

On opening the above page in the browser you will get following output:


Placing JavaScript in a HTML document Before you exactly learn the syntax of javaScript you must know where you can write the javaScript code. JavaScript code can be inserted in the head tag as well as in the html document. You only require using


Writing scripts in the body section of a webpage: 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.








Note: You can place any number of JavaScripts in both the body and the head section of the document. Check out the following code:









In the above code javaScript has been written in the head as well as the body section of the document.

Linking a Webpage to an External JavaScript: It is possible that you may want to run a JavaScript in several pages without actually writing the same script again and again.. This can be done by making an external JavaScript file and linking it with the webpage. The external JavaScript file needs to be saved with a .js file extension. To use the external script you need to link to the external .js file by giving the file path in the "src" attribute of the





In the above code using the ‘src’ attribute of the script tag webpage has been linked to an external javaScript code. While executing this document browser will look for the ‘trial.js’ file to execute its code. You should be careful as the .js file does not include the

Comments

Popular posts from this blog

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
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

System Analysis and Design (SAD)

Introduction to System Analysis and Design (SAD) System are created to solve Problems. One can think of the systemsapproch as an organised way of dealing with a problem. In this dynamic world , the subject system analysis and design, mainly deals with the software development activities. This post include:- What is System? What are diffrent Phases of System Development Life Cycle? What are the component of system analysis? What are the component of system designing? What is System? A collection of components that work together to realize some objectives forms a system. Basically there are three major components in every system, namely input, processing and output. In a system the different components are connected with each other and they are interdependent. For example, human body represents a complete natural system. We are also bound by many national systems such as political system, economic system, educational system and so forth. The objective of the system demands tha...