Declaring JavaScript Code
This article will guide you to declaring javascript code in your html/server side programming code.
- JavaScript can be used either directly in the HTML page or in a separate external file
- The external file will be importing in the Web file. The external file should have .js extension
- If you are planning to write your JavaScript code inside the web page then you will need to include the tag inside your web page
- But if you are using a separate file then you will have to include the js file using
- Usually the include code are written in the tag but you can insert it wherever you want. However it is recommend to write all the javascript includes in the tag. This way your JavaScript code will be differentiated from the HTML/Programming code and furthermore your HTML page will be easier to read and understand
Example – Declare JavaScript Code
<html> <head> <script type="text/javascript"> document.write("This is from inline HTML code.") </script> </head> <body>...</body> </html>
Custom Search
Popular Articles:
- Java Plugin detection using JavaScript
- JSON in Javascript
- Passing Data From JavaScript to Adobe Flash Movie
- Associative Arrays in JavaScript
- Show/Hide HTML Elements using JavaScript
- JavaScript Tutorial – Sorting Numeric Array
- JavaScript Tutorial – Search inside Array without Looping
- Showing Dynamic DIV above HTML SELECT Control
- JavaScript XML Parsing on Mozilla Firefox / Opera Browsers
- Timers Function in JavaScript


































