DevonL
05-14-2009, 03:48 PM
Alright I'm trying to create a small pop up div table to describe something ... yet it's not working, at all. This is the JavaScript I have at the moment:
function showHelp(id) {
document.getElementById("tb_top").innerHTML = "<b>" + title[id];
document.getElementById("tb_mid").innerHTML = texts[id];
document.getElementById("tb_bot").innerHTML = "<a href=javascript:hideHelp()>Close</a>";
s = document.getElementById("help_layer");
w = document.body.clientWidth;
h = document.body.clientHeight;
s.style.pixelLeft = (w - s.clientWidth) / 2;
s.style.pixelTop = ((h - s.clientHeight) / 2) + document.body.scrollTop;
s.style.visibility = "visible";
}
function hideHelp() {
document.getElementById("help_layer").style.visibility = "hidden";
}
title[1] = "Time Test 1";
text[1] = "This is just some random text";
And this is the HTML for the div:
<div id=help_layer style="position:absolute; z-index:20; visibility:hidden; top:0px; left:0px;">
<table bgcolor=white width=250 border=2 cellpadding=5 cellspacing=1>
<tr><td id=tb_top bgcolor=#79A6D0><b></b></td></tr>
<tr><td id=tb_mid></td></tr>
<tr><td id=tb_bot></td></tr>
</table></div>
The div however is actually showing up at the bottom of the screen and when clicking on the link: (<a href=javascript:showHelp(1)>?</a>) it simply does nothing. Any help or insight? Thanks
function showHelp(id) {
document.getElementById("tb_top").innerHTML = "<b>" + title[id];
document.getElementById("tb_mid").innerHTML = texts[id];
document.getElementById("tb_bot").innerHTML = "<a href=javascript:hideHelp()>Close</a>";
s = document.getElementById("help_layer");
w = document.body.clientWidth;
h = document.body.clientHeight;
s.style.pixelLeft = (w - s.clientWidth) / 2;
s.style.pixelTop = ((h - s.clientHeight) / 2) + document.body.scrollTop;
s.style.visibility = "visible";
}
function hideHelp() {
document.getElementById("help_layer").style.visibility = "hidden";
}
title[1] = "Time Test 1";
text[1] = "This is just some random text";
And this is the HTML for the div:
<div id=help_layer style="position:absolute; z-index:20; visibility:hidden; top:0px; left:0px;">
<table bgcolor=white width=250 border=2 cellpadding=5 cellspacing=1>
<tr><td id=tb_top bgcolor=#79A6D0><b></b></td></tr>
<tr><td id=tb_mid></td></tr>
<tr><td id=tb_bot></td></tr>
</table></div>
The div however is actually showing up at the bottom of the screen and when clicking on the link: (<a href=javascript:showHelp(1)>?</a>) it simply does nothing. Any help or insight? Thanks