<script type = "text/script">
script标签可以用来定义js代码,也可以用来引入js代码,但是两个功能二选一,不能同时使用两个功能
如果要同时使用,要再写一次
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type = "text/javascript" src='<jsp:body></jsp:body>'>
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type = "text/javascript" src='<jsp:body></jsp:body>'>
</script>
<script type = "text/javascript" >
alert("Hello啊");
</script>
</head>
<body>
我爱java
</body>
</html>
<script type = "text/javascript" >
alert("Hello啊");
</script>
</head>
<body>
我爱java
</body>
</html>
script特殊的值:
undefined:未定义,所有js变量未赋予初始值的时候,默认值都是undefined
null:空值
NAN:Not a number 非数字,非数值
JS中的定义变量格式:
var 变量名;
var 变量名 = 值;