Posts in current category
May 02, 2021 14:31 HTML
Insert a script
How to insert a script into an HTML document.
Use the hashtag
How to deal with browsers that do not support scripts or disable scripts.
Elements can contain both script statements and point to external script files through the src property.
The following script outputs "Hello World!" to the browser. ：
If the "src" property is used, the element must be empty.
The label provides alternatives when scripts are not available, such as when the browser disables the script, or when the browser does not support the client script.
Elements can contain all the elements that can be found in the body element of a normal HTML page.
The contents of the element are displayed only if the browser does not support the script or disables the script:
Tip: The label supports global properties, view the full property sheet HTML global properties!
If the browser doesn't recognize the label at all, the content contained in the label will appear on the page in text. T
o avoid this, you should hide the script in the comment label. T
hose older browsers (browsers that don't recognize the label) ignore these comments, so the contents of the label are not displayed on the page. A
nd those new browsers will read the scripts and execute them, even if the code is nested within the comment label.