+ 7

GetElementBy id using variable?

pos = "bottom"; document.getelementbyid("player").style.pos Pos has to be a variable can anyone help me please?

2nd Apr 2018, 5:55 PM
Arne Van Kerckvoorde
Arne Van Kerckvoorde - avatar
2 Respostas
+ 11
var player = document.getElementById("player"); player.style[pos] = .......
2nd Apr 2018, 6:12 PM
Burey
Burey - avatar
+ 1
...'player').style.position=pos;
2nd Apr 2018, 10:28 PM
wenz
wenz - avatar