+ 2

Border

I can’t change the border of an object at all in JavaScript. var elem = document:getElementById(“example”) elem.style.borderWidth = “10px” elem.style.borderColor = “#FFF” I’ve tried changing it around so many ways and it still didn’t work. (I also tried doing rgba and it didn’t work at all, does it work differently on border?)

28th Dec 2017, 7:02 PM
Norberttony
Norberttony - avatar
5 Respuestas
+ 4
what i have seen from your codes. you have forgotten to add semicolon (;) after every statement ie. var elem = document:getElementById(“example”); elem.style.borderWidth = “10px”; elem.style.borderColor = “#FFF”;
28th Dec 2017, 7:07 PM
MR Programmer
MR Programmer - avatar
+ 3
@Norberttony share your complete code 😅.
28th Dec 2017, 7:23 PM
MR Programmer
MR Programmer - avatar
0
or just do elem.style.border="5px solid black"; kill two birds with a stone
28th Dec 2017, 7:10 PM
᠌᠌Code X
᠌᠌Code X - avatar
0
I have tried ending every statement with ; But it still didn’t work... I tried doing elem.style.border as well, and it didn’t work either.
28th Dec 2017, 7:21 PM
Norberttony
Norberttony - avatar
0
Shoot, now my for statement doesn’t work... for (a = 1; a <= planets; a++){ //planets is equal to 2 var pl = newplanet() //Generates new planet alert(a) //Alerts a, output is 201 <—- How is output 201?? game["p" +(a)] = pl //Not important }
28th Dec 2017, 7:29 PM
Norberttony
Norberttony - avatar