Friday, 16 December 2016
javascript dosnt seem to be working
Answer
Answer
im trying to build a minesweeper in html and the javascript isnt woking
heres my html
href = "minesweeper.css" >
here is the css
td{
border: 2px outset #000000;
width:25px;
height: 25px;
background-color: #cfcfcf;
}
and here is the javascript (minesweeper.js)
var gameBox = document.getElementById("i").innerHTML;
console.log(gameBox);
for ( var i = 0 ; i < 3 ; i++ ) {
gameBox += "";
console.log(gameBox);
for ( var j = 0 ; j < 3 ; j++ ) {
gameBox += " ";
}
gameBox += " ";
}
and all i get is a blank page
heres a link to the page
http://borisute.com/geshem/2013/mkeller/minsweeper.html
(it has some more code i didnt include b/c its not relevant to the above problem
Answer
You still need to put the gamebox onside the html at the end of the script:
var gameBox = document.getElementById("i").innerHTML;
for ( var i = 0 ; i < 3 ; i++ ) {
gameBox += "";
for ( var j = 0 ; j < 3 ; j++ ) {
gameBox += " ";
}
gameBox += " ";
console.log(gameBox);
}
document.getElementById("i").innerHTML = gameBox;
Subscribe to:
Post Comments (Atom)
c++ - Does curly brackets matter for empty constructor?
Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...
-
Iv'e read a lot of posts both in stackoverflow and other websites talking about web security. Such as salting encrypting etc. ...
-
In K-PAX , there are two possible explanations: Prot is crazy. He is truly an alien. There are facts that indicate 1, but also 2. Examples: ...
-
System.out.print("Name : "); String name = in.nextLine(); System.out.print("Age : "); int age = ...
No comments:
Post a Comment