...

View Full Version : CSS not applied to table in DIV



JaganGudipati
10-22-2010, 06:55 PM
Hi

I have a php code in which the data is displayed in a table. The table is defined in <div> tag. When the data is displayed repeatedly in the table the position is not proper. Can somebody help me. My expectation is that the table should be positioned at the same place even it is repeatedly called.

The code snippet is as follows:

<?php
echo ("<html>");
echo ("<head>");
echo ("</head>");
echo ("<body>");
echo ("<form name='TablesTest'>");
$istring = "1,2,3,4,5,|Desc1,Desc2,Desc3,Desc4,Desc5,|";
DisplayRecordSet($istring);
echo ("<div style='POSITION: absolute; LEFT: 250px; WIDTH: 300px; TOP: 50px; HEIGHT: 50px;'id='NavButtons' name='NavButtons'>");
echo ("<input type='Button' name='Next' value='Next' onClick='DisplayRecords();'>");
echo ("</div>");
echo ("</form>");
echo ("</body>");
echo ("</html>");

function DisplayRecordSet($iname)
{
list($iCodestring,$iDescstring) = explode("|",$iname);
$iCode = explode(",",$iCodestring);
$iDesc = explode(",",$iDescstring);
echo ("<div style='POSITION: absolute; LEFT: 250px; TOP: 140px; WIDTH: 300px; HEIGHT: 300px;' id='Details' name='Details'>");
echo ("<TABLE border=2>");
echo ("<TR>");
echo ("<TD colspan=15 align=center><SPAN style='color: #000'>ID</SPAN></TD>");
echo ("<TD colspan=80 align=center><SPAN style='color: #000'>Description</SPAN></TD>");
echo ("</TR>");
for ( $x = 0; $x < 5; $x++)
{
echo ("<TR><TD colspan=15><SPAN style='color: #000'>".$iCode[$x]."</SPAN></TD><TD colspan=80><SPAN style='color: #000'>".$iDesc[$x]."</SPAN></TD></TR>");
}
echo ("</TABLE>");
echo ("</div>");
}
?>

<script type="text/javascript">
<!--
function DisplayRecords()
{
document.getElementById("NavButtons").innerHTML= "<?php DisplayRecordSet("10,20,30,40,50,|Desc10,Desc20,Desc30,Desc40,Desc50,|"); ?>";
}
/-->
</script>

Fou-Lu
10-22-2010, 09:27 PM
This is the wrong forum; this one is designed for posting usable snippets for PHP.

I'm not convinced this is a problem with PHP. It looks to me like this is an issue with your HTML/CSS and potentially your JS. Best I can tell from looking at this, the PHP itself should process just fine without any errors.
For the meantime, I'll move this to HTML/CSS, unless its determined to be an issue with the JS.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum