When I use HTM to create a table, It seems the width tag work fine but not the height tag.
Anyone have a idea?
This is my source:
var html = "<html>"
html += "<body>"
html += "<head>"
html += "</head>"
html += "<table cellpadding=0 cellspacing=0 width=220 height=5000 bgcolor=#F2F2FF style=\"border-style:solid; border-width:1px; border-color:#ECE9D8;\">"
html += " <tr height=5%>"
html += " <td> </td>"
html += " </tr>"
html += "</table>"
html += "</body>"
html += "</html>"
globals.texte_html = html
There are a few things wrong in your HTML.
The TABLE and TR tags normally don’t have height properties. It’s not valid HTML.
You have to set the height in the TD tags.
And you might have to use real (pixel) values instead of percentages too.
The Sun HTML engine supports HTML 3 and most of HTML 4. Also CSS1 is partly supported.
The following code will work (giving the row a 30 pixel height)
var html = "<html>"
html += "<body>";
html += "<head>";
html += "</head>";
html += "<table cellpadding=0 cellspacing=0 width=220 bgcolor=#F2F2FF style=\"border-style:solid; border-width:1px; border-color:#ECE9D8;\">";
html += " <tr>" ;
html += " <td height=30> </td>";
html += " </tr>";
html += "</table>";
html += "</body>";
html += "</html>";
globals.texte_html = html;
I see you need to escape your double quotes. One way around this is to use double quotes inside the HTML but for the HTML string you use single quotes.
Like this:
var html = '<html>';
html += '<body>';
html += '<head>';
html += '</head>';
html += '<table cellpadding=0 cellspacing=0 width=220 bgcolor=#F2F2FF style="border-style:solid; border-width:1px; border-color:#ECE9D8;">';
html += ' <tr>';
html += ' <td height=30> </td>';
html += ' </tr>';
html += '</table>';
html += '</body>';
html += '</html>';
globals.texte_html = html;
I see you also use borders. In 2005 I have written a ServoyMagazine article on the usage (and gotchas) of custom borders in Servoy.
You might want to check that out as well.
The Sun rendering engine is primitive, but it is still worth keep as close to modern (X)HTML as possible.
Tags like “Height”, “Font” etc mixed into the HTML is the old way of doing thing. See the book “Designing With Web Standards” by Jeffey Zeldman.
Current thinking is to keep the styling separate as a CSS. You can easily embed a simple CSS style sheet into header of your HTML. The sun engine only supports a subset of CSS, so many things don’t work.
See the discussions on this forum and the Servoy documentation for a list of what works.
You can also keep style sheets in global variables so you can change the styling easily.