Home > Article > Web Front-end > What tags do javascript use?
Javascript is implemented using the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag; the 3f1c4e4b6b16bbbd69b2ee476dc4f83a and 2cacc6d41bbb37262a98f745aa00fbf0 tags tell JavaScript where to start and end; the browser will interpret and execute the 3f1c4e4b6b16bbbd69b2ee476dc4f83a and < JavaScript code between ;/script>.
The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.
What tags are used to implement JavaScript?
If you need to insert JavaScript into an HTML page, you need to use the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag.
JavaScript Usage
Scripts in HTML must be placed between the 3f1c4e4b6b16bbbd69b2ee476dc4f83a and 2cacc6d41bbb37262a98f745aa00fbf0 tags.
Scripts can be placed in the 6c04bd5ca3fcae76e30b72ad730ca86d and 93f0f5c25f18dab9d176bd4f6de5d30e sections of the HTML page.
3f1c4e4b6b16bbbd69b2ee476dc4f83a Tag
To insert JavaScript into an HTML page, use the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag.
3f1c4e4b6b16bbbd69b2ee476dc4f83a and 2cacc6d41bbb37262a98f745aa00fbf0 tell JavaScript where to start and end.
The lines between 3f1c4e4b6b16bbbd69b2ee476dc4f83a and 2cacc6d41bbb37262a98f745aa00fbf0 contain JavaScript:
<script> alert("我的第一个 JavaScript"); </script>
You don’t need to understand the code above. Just understand that the browser will interpret and execute the JavaScript code between 3f1c4e4b6b16bbbd69b2ee476dc4f83a and 2cacc6d41bbb37262a98f745aa00fbf0
lamp Older instances may use type= in the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag "text/javascript". This is no longer necessary. JavaScript is the default scripting language in all modern browsers as well as in HTML5.
JavaScript in6c04bd5ca3fcae76e30b72ad730ca86d
In this example, JavaScript writes text to the HTML's 6c04bd5ca3fcae76e30b72ad730ca86d when the page loads:
Example
<!DOCTYPE html> <html> <body> . . <script> document.write("<h1>这是一个标题</h1>"); document.write("<p>这是一个段落</p>"); </script> . . </body> </html>
JavaScript functions and events
The JavaScript statement in the above example will be executed when the page is loaded.
Usually, we need to execute code when an event occurs, such as when the user clicks a button.
If we put JavaScript code into a function, we can call the function when the event occurs.
[Related recommendations: javascript advanced tutorial]
The above is the detailed content of What tags do javascript use?. For more information, please follow other related articles on the PHP Chinese website!