测试javascript中函数中有return关键字
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试javascript中函数中有return关键字</title>
<link rel="stylesheet" type="text/css" href="body.css">
</head>
<body>
<div align="center">
<h2>测试javascript中函数中有return关键字</h2>
<input id="number" type="text" value="0"><br><br>
<input type="button" value="点击我(测试javascript中函数中有return)" onclick="test2()">
</div>
<script type="text/javascript">
function test1(number) {
if (number == 0) {
alert("number = " + number);
return;
}
alert("我是" + number);
}
function test2(){
test1(document.getElementById("number").value);
document.getElementById("number").value = 'ss';
alert("我是函数test2()");
}
</script>
</body>
</html>