JavaScript代碼不執行


<!doctype html>
<html>
<head>
	<meta charset="utf8">
	<title>正確寫jQuery</title>
	<link rel="stylesheet" href="style.css">
</head>

<body>
	<header>
		<h3>碧藍空間
	</header>
	<nav>
		<ul>
			<li id="TitleInfo">實用鏈接:</li>
			<li><a href="">新浪</a></li>
			<li><a href="">百度</a></li>
			<li><a href="">軍事</a></li>
		</ul>
	</nav>
	<p>記錄你的生活:<textarea cols=50 rows=3 ></textarea>
	<p><input type='submit' value='存檔'></p>
	
	<script type="text/javascript" src="jquery.js">

		alert("您將要提交到服務器");
		console.log("hello");
		$('input[type="submit"]').on("click", function(){
			alert("您將要提交到服務器");
		})
	</script>
</body>
</html>

上面代碼中的<Script>標簽之間JS代碼不會執行,因為這個標簽已經指明了是引用jQuery文件。應該在新的
<Script>標簽中寫代碼:
	<script type="text/javascript" src="jquery.js"> <script>
     <script>
		alert("您將要提交到服務器");
		console.log("hello");
		$('input[type="submit"]').on("click", function(){
			alert("您將要提交到服務器");
		})
	</script>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM