<input>是不是只能放在index.html的<body>里,不能放在外部文件script.js里
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全帶,準(zhǔn)備啟航</title>
<!--引入外部文件的方式-->
<script src="script.js">
</script>
</head>
<body>
? ? <input name="Button" type="button" value="click" onclick="tanchu()" />
</html>
</body>
</html>
當(dāng)我把?<input name="Button" type="button" value="click" onclick="tanchu()" />放在script.js里,就無法執(zhí)行了
2017-07-19
你這樣是不行的,你可以把這行代碼插入進去嘛。。。XXX.append('<input name="Button" type="button" value="click" onclick="tanchu()" />')
2017-07-18
<script src=“script.js”type="text/javascript"> </script>
2017-07-18
放在js里的代碼,你需要調(diào)用它,在你想表達(dá)的地方,寫一個調(diào)用函數(shù)