inline scripts between a pair of tags,
from the external file specified by the src attribute of the tag:
In the XHTML markup language, the contents of the tag
- innerHTML - using, write inside an HTML element.
- document.write () - using, write inside an HTML element.
- window.alert () - using, record inside the notification window.
- console.log () - using, record inside the browser console.
Scripts in external files
Using a tag with the src attribute has several advantages:
HTML event handlers
Some browsers (such as Firefox) execute program code in the URL and use the return value as the content of the new displayed document. Just like when clicking on the http: link, the browser erases the current document and displays the new content. The value returned by the example above does not contain HTML tags, but if they were, the browser could display them just like any other HTML document loaded into the browser.
Other browsers (such as Chrome and Safari) do not allow URLs, as in the example above, to overwrite the contents of the document - they simply ignore the return value. However, they do support URLs of the form:
Without the void operator in this URL, the value returned by the Window.open () method would be converted to a string and (in some browsers) the current document would be overwritten with a new document.