Basics of Javascript Programming-Desiliciouskitchen


Desiliciouskitchen-JavaScript code can be inserted into HTML, ASP, or PHP documents by inserting it between the <script> tag and the </script> tag, the javascript code can be written in the head or body section. in general javascript code is written in web documents in the following way:

  1. <script type=”text/javascript”>
  2. ….
  3. javascript code
  4. ….
  5. </script>

Read This: Understanding and History of the Development of Javascript

In the javascript opening tag, the attribute type=”text/javascript” is inserted. This attribute will inform the browser that the script program contained in the tag is javascript in text format.

How to insert javascript in an HTML document is also called embedded javascript programming. Because the javascript program is written between the text and HTML document tags. Apart from using the embedded technique, javascript writing can also be done in a separate javascript document with the js file format.

Read This: Learn C Programming Language For Beginners-Desiliciouskitchen

The following is an example of writing javascript with embedded techniques.

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset=”UTF-8″>
  5. <title>My first JavaScript</title>
  6. </head>
  7. <body>
  8. <h1>Javascript with Embedded</h1>
  9. <script type=”text/javascript”>
  10. write(“This is my first javascript program”);
  11. </script>
  12. </body>
  13. </html>

If the javascript code is taken from an external source file then the javascript file can be called via the src attribute.

  1. <script type=”text/javascript” src=”documentjavascript.js”></script>

The javascript code above means that it will be a javascript document with the name javascriptdocument on.js in the same folder as the html document.

Check Also

Understanding and History of the Development of Javascript-Desiliciouskitchen

INTRODUCTION TO JAVASCRIPT Desiliciouskitchen-Javascript is a language used to make HTML documents displayed in a …

Leave a Reply

Your email address will not be published.