Div tag in html area not working

HI,

In my application i am using html area where i am using Div tag of html. it not working. this is sample code

var html = “”;
html += “

Test
”;

html += "<div id=‘div1’ style=“position:absolute; padding:0px; left:93;top:9; width: 92; height: 94; z-index:100; background-color:#7eae58’> Hello”;
html += “”;

Any one has any idea about it…?

Thank you

Hi pcm,

The problem with your code is that your HTML is not valid.

You use a DIV inside a table but outside a table cell.
Also the BODY tag is not closed and you have that second tag in the wrong place, before the TABLE closing-tag instead of after.
Also the TR tag is not closed and is not a valid HTML tag.
Then in your DIV tag you use single quotes and double quotes. These are not balanced either.

So if you fix all this then your code could look something like this:

var html = "<html><body>"; 
html += "<table border=1><tr><td>Test</td><td>Result</td></tr></table>"; 
html += "<div id='div1' style=\"position:absolute; padding:0px; left:93;top:9; width: 92; height: 94; z-index:100; background-color:#7eae58\"> Hello</div>"; 
html += "</body></html>";

Hope this helps.

hi Robert,

I have commited mistake in posting a code. i have fixed it.
i was thinking that div tag was not working now it is working.

I have tried with JEditorPane.

style="position:absolute; padding:0px; left:93;top:9; width: 92; height: 94; z-index:100;

Properties are not working. rest of the things are working. with div tag

do you have any idea why is not working.? Is it support CSS or not.?

Thank you

Hi pcm,

I dunno about a JEditorPane but in a HTML_AREA it does work.
Why do you use a JEditorPane ?

Why do you use a JEditorPane ?

Same thing tried in HTML_Aream but didn’t work. That’s why i have used JEditorPane. Same Result in JEditorPane as well.

I want to overlap few cells in table with a lable or div according to the condition. first i tried in HTML_Area it didn’t work, after that in JEditorPane. didn’t get +ve result.

Do u have any idea how i can make it possible?

Thank you

Those components use the Sun HTML render engine. This engine hasn’t been updated in a long while. It supports HTML3 and a large part of v4. Same with CSS, not completely supported.
If you need to use overlapping divs and such I suggest you take a look at the Browser bean from IT2Be. (http://www.it2be.com)

Hope this helps.

I’ll try with that.

Thank you Robert for ur support.