在HTML页面中,<script>标记中大部分使用了text / javascript。
这是一个例子
<script type="text/javascript"> </script>
但是,HTML5的引入带来了一些新的改进。JavaScript成为HTML5和现代浏览器的默认语言。因此,现在不需要在<script>标记中添加文本/ javascript。
<script> </script>
让我们看一下jQuery中的示例。
<html>
<head>
<title> jQuery Example</title>
<script src = “https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
document.write("Hello, World!");
});
</script>
</head>
<body>
<h1>Hello</h1>
</body>
</html>