mwl707 Posted September 21, 2009 Share Posted September 21, 2009 Hi I have a page with a div box. By default it is set to "hidden". On a click I want to make the box visible and then subject subject to conditions, draw a table inside the div (At this stage it is just a 10x10 table) , When I do click and run the javascript function I dont get the div box just get a blank page with the table, Can anyone help me please ? I hope I have included all the information needed . Thanks from my page I call the function visible() function visible() { document.getElementById("window").style.visibility = "visible"; drawallocatetable() function drawallocatetable() { document.write('<center><table width="200" border="0">'); for (j=1;j<=10;j++) { document.write('<tr>'); for (i=1;i<=10;i++) { document.write('<td>' + i*j + '</td>'); } document.write('</tr>'); } document.write('</table></center>'); } my HTML/PHP code contains this Div tag and at this stage no table is drawn <div id='window' >The Title </div> and this in the <style> , #window { position:absolute ; width: 600px; height:400px; background-color:#39C ; border: 4px solid black; z-index:1 ; visibility:hidden ; left:50% ; margin-left:-300px; Quote Link to comment https://forums.phpfreaks.com/topic/174994-solved-table-inside-a-div/ Share on other sites More sharing options...
marynorth21 Posted September 21, 2009 Share Posted September 21, 2009 It's hard to do tables in css but let me try to help you out. Quote Link to comment https://forums.phpfreaks.com/topic/174994-solved-table-inside-a-div/#findComment-922302 Share on other sites More sharing options...
KevinM1 Posted September 21, 2009 Share Posted September 21, 2009 document.write starts writing at the beginning of the document, overwriting what was originally there. Use innerHTML when building your table instead. Also, your visibility toggle should be toggling between hidden and block, as a div is a block element. Quote Link to comment https://forums.phpfreaks.com/topic/174994-solved-table-inside-a-div/#findComment-922303 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.