Jump to content

Help with popup div?


Dark-Hawk

Recommended Posts

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

Link to comment
Share on other sites

Keep an eye on your browsers error console, it should have pointed out the same error as Ken2k7 did. (Think all browsers have one, at least Firefox, Opera and Internet Explorer do for sure)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.