JavaScript Placement
JavaScript Placement
You can put quite a few contents in a HTML record.Contents can be put in the <body>, or in the <head> segment of an HTML page, or in both.
JavaScript in <head>.
To have a content sudden spike in demand for some occasion, for example, when a client clicks some place, then you will put that content in the head as
follows:-
JavaScript in <body>.
Assuming that you really want a content to run as the page stacks so the content creates content in the page, then the content goes in the <body> piece of the report. For this situation, you wouldn't have any capability characterized utilizing JavaScript.
External JavaScript.
Outer contents are reasonable when a similar code is utilized in a large number
different pages.
JavaScript documents have the record expansion .js.
To utilize an outside script, put the name of the content document in the sre (source) property of a <script> tag:
Putting scripts in outside records enjoys a few benefits:
. It isolates HTML and code
. It makes HTML and JavaScript simpler to peruse and keep up with
. Reserved JavaScript records can accelerate page loads
To add a few content documents to one page utilize a few content labels
Scripts put in outer records:
To utilize an outer content, put the name of the content record in the sre
(source) property of a <script> tag:
Comments
Post a Comment
if you have any dought then let's me know