JavaScript Programming-Calling JavaScript |
But unfortunately the browser still executes JavaScript so the browser will display the same output as it inserted in the tag <body>.
Maybe you can understand this explanation, therefore we will proceed to the next material as the title above Calling Javascript so with the help of this friendly HTML and JavaScript we can hide and show an element, at this situation we will call JavaScript because if it is not called it will hide the element, here's what it looks like:
You can just put the JavaScript and the caller in the <body> tag as follows:
The important thing is that the caller's position must be below the JavaScript that will be called, don't get it upside down, it's obvious that the result is an error or doesn't appear, because the nature of the browser will execute the lines of code from top to bottom.
For the demo, please copy the code above then paste it in the HTML Editor>HTML tab. To see the results, select the output tab.
Thank you. Hope it's useful.