在 HTML 页面中,<script> 标签中主要使用 text/javascript。
这里有一个例子
<script type="text/javascript"> </script>
但是,HTML5 的引入带来了一些新的改进。JavaScript 成为 HTML5 和现代浏览器的默认语言。因此,现在不需要在 <script> 标签中添加 text/javascript。
<script> </script>
让我们看一个 jQuery 中的示例。
<html> <head> <title> jQuery Example</title> <script src = “https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ document.write("Hello, World!"); }); </script> </head> <body> <h1>Hello</h1> </body> </html>
如果您发现内容有误或提出修改建议,请随时向我们发送 E-mail 邮件:
421660149@qq.com
您的建议已发送到 W3schools。