Jump to content
Now you can advertise your business on Top Gold Forum.
Sign in to follow this  
onlineprediction

How do you add JavaScript to HTML?

Recommended Posts

The first way to add JavaScript to HTML is a direct one. You can do so by using the <script></script> tag that should encompass all the JS code you write. JS code can be added:
between the <head> tags
between the <body> tags
Depending on where you add the code the JavaScript in your HTML file, the loading will differ.

Share this post


Link to post
Share on other sites

JavaScript is most commonly used as a client side scripting language. This means that JavaScript code is written into an HTML page. When a user requests an HTML page with JavaScript in it, the script is sent to the browser and it's up to the browser to do something with it.


Cheap VPS | $1 VPS Hosting

Cheap Dedicated Server | Free IPMI Setup

Share this post


Link to post
Share on other sites

To include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the <head> tags in your HTML document.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...