If You Want top backlinks or free guest posting on our blog Lets do it Adsense Ready theme Now!

JavaScript Programming-Calling JavaScript

this time we will discuss how to call JavaScript either in the tag or in the tag. let's start the material, in the past material we hav
irfan bhai

JavaScript Programming-Calling JavaScript
 JavaScript Programming-Calling JavaScript

Hi Web Developers! back again with the tech teacher. this time we will discuss how to call JavaScript either in the <head> tag or in the <body> tag. let's start the material, in the past material we have discussed how to insert JavaScript or embedded in HTML elements like this:


If the insertion is like the one above, the text of this JavaScript will automatically appear as "This text comes from embedded JavaScript". Unlike the case if we insert it in the <head> tag as follows:





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.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.