Uncatched Reference error: scan not defined.
下面是代碼:
<html>
<head>
<script type="text/javascript" src="../js/jquery.js"></script> <script type="text/javascript">
$(document).ready(function() {
function scan() {
$("#result").text("<font style='color: green;'>Cote</font>"); console.log("Function ran");
}
});
</script>
</head>
<body>
<font style="font-size: 84px;">Scan card, please</font>
<p id="result">cotes</p>
<input style="font-size: 36px;" id="input" maxlength=16 autofocus onkeyup="scan();">
</body>
</html>
不要把util函數放在一個就緒狀態,它們需要是全局的才能被內聯js看到。因爲他們自己什麼都不做,所以沒有必要推遲。 – dandavis
什麼是掃描功能範圍? – MaxZoom