Dark-Hawk Posted May 14, 2009 Share Posted May 14, 2009 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 Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 Well, upon first glance, texts[1] is undefined. It should be text[1]. Quote Link to comment Share on other sites More sharing options...
Axeia Posted May 15, 2009 Share Posted May 15, 2009 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) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.