Reputation: 175
I want to make a pop up window appear on the center of the screen,however when i use marginTop property the window does not appear.If remove marginTop property it appears always on upper left side corner. I use php 5.4 . What am I doing wrong?
function show_popup(id) {
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none") {
obj.style.marginTop = 20%; //if i remove this line it works
obj.style.display = "";
}
}
}
Upvotes: 0
Views: 42
Reputation: 176896
I think you need to apply "20%"
for that like as below
obj.style.marginTop = "20%";
Check Syntax over here Style marginTop Property
Upvotes: 1
Reputation: 81617
Did you try to set obj.style.marginTop = "20%"
(with the "
) ?
Upvotes: 1