還好這裏的問題 - ..我嘗試過,但我的js不能正常使用IDK的我哪裏錯了here is the questionHTML ---的JavaScript/JSON
問題是之後的JS執行時沒有按」運行...像IDK那樣存在問題;我知道它負載,但IT一點兒也不工作
<html>
<head>
<script src="q2.js" type="text/javascript"> </script>
</head>
<div > Input 1 <input type="text" id ="input1"></div>
<div> Input 2 <input type="text" id ="input2"> </div>
<div> Result <div id="result"> </div></div>
<button onclick= "compute()">Compute</button>
</body>
</html>
JS的是在這裏
function compute(){
var n = (document.getElementById("input1").value;
var m = document.getElementById("input2").value;
var i,j;
if (Number(n)){
}
else {
alert("Error! Please put a valid Number - on input 1 ");
}
if (Number(m)){
}
else {
alert("Error! Please put a valid Number - on input 2 ");
}
for(i = 0; i < n; i++){
for(j = 0; j < m; j++){
result.innerHTML += "X";
if(j == (m-1)){
result.innerHTML += "<br />";
}
}
}
}
'這裏是question'外部圖像的鏈接對於這個問題的未來讀者是沒用的,如果這個圖像消失 –