Java script is used to change HTML. It can change HTML attribute’s value and HTML style (CSS).
It was invented by Brendan Eich in 1995, later Javascript became ECMA standard in the year 1997.
Introduction
Javascript is an essential component of web development. In HTML JavaScript code is inserted between <script> tags.
Scripts can also be stored in separate external files ending with .js extension. External Javascript files are useful in places where same js code is to be used on different pages.
<script>
…………
JavaScript code goes here….
</script>
JavaScript is the main scripting language in HTML
Advantages of external .js file
- It seperates HTML and code.
- It makes HTML and Javascript easier to read and maintain.
- cached Javascript can speed up page loading time.
JavaScript Functions
JavaScript Functios are block of codes
JavaScript Functions can be entered in <head>——</head>
Or <body>———</body>section in HTML.
JavaScript print
JavaScript print function can be used to print the current window.
<!DOCTYPE html> <html> <body> <h2>The window.print() Method</h2> <p>Click the button to print the current page.</p> <button onclick=”window.print()”>Print this page</button> </body> </html> |
Leave a Reply