S
sil
Hi All,
I am new to HTML and JavaScript.
I am using Javascript to write an HTML table into an HTML div.
However, the data from the table appears, inside the DIV, like one
long line. When I am using the same Javascript code to write the same
table to a HTML page the table appears OK.
The question is: Are there some specific things that I should do when
writing HTML code to a DIV versus writing HTML code to an HTML page?
It looks like inside a DIV the HTML table formatting is gone, only the
data is present.
Thanks in advance for any help on this matter. See snippet of my code
below:
function wDoc( wtxt )
{
document.getElementById('profile').innerHTML+=wtxt;
}
function wDocClear()
{
document.getElementById('profile').innerHTML="";
}
function UpdateProfile() //Partial code
{
var nSelProf =
ME.ACCT_PROFILE.options[ME.ACCT_PROFILE.selectedIndex].value;
// Record the currently selected profile for when we
Submit this form.
ME.PROFILE_INDEX.value = nSelProf;
wDocClear();
// Write the top, fixed, portion of the document
wDoc( '<html>' );
wDoc( '<head>' );
wDoc( '<\/head>' );
wDoc( '<body bgcolor="#FFFFFF" topmargin="0"
leftmargin="0">' );
// If there us no Profile selected give them a
message.
if( nSelProf == -1 )
{
wDoc(' <DIV ALIGN="CENTER"><H2>There is no
Profile currently selected.<\/H2><\/DIV>' );
}
else
{
//wDoc( "<div class='enc-acct'>Account<\/
div>" );
//wDoc( "<div class='enc-prod'>Products<\/
div>" );
wDoc( '<BR>' );
wDoc( '<TABLE CELLPADDING="1" CELLSPACING="0"
BORDER="1" ALIGN="CENTER">' );
wDoc( ' <TR>' );
wDoc( '<TH><strong> Account <\/TH>' );
wDoc( '<TH
COLSPAN="2"><strong> Products <\/TH>' );
wDoc( ' <\/TR>' );
I am new to HTML and JavaScript.
I am using Javascript to write an HTML table into an HTML div.
However, the data from the table appears, inside the DIV, like one
long line. When I am using the same Javascript code to write the same
table to a HTML page the table appears OK.
The question is: Are there some specific things that I should do when
writing HTML code to a DIV versus writing HTML code to an HTML page?
It looks like inside a DIV the HTML table formatting is gone, only the
data is present.
Thanks in advance for any help on this matter. See snippet of my code
below:
function wDoc( wtxt )
{
document.getElementById('profile').innerHTML+=wtxt;
}
function wDocClear()
{
document.getElementById('profile').innerHTML="";
}
function UpdateProfile() //Partial code
{
var nSelProf =
ME.ACCT_PROFILE.options[ME.ACCT_PROFILE.selectedIndex].value;
// Record the currently selected profile for when we
Submit this form.
ME.PROFILE_INDEX.value = nSelProf;
wDocClear();
// Write the top, fixed, portion of the document
wDoc( '<html>' );
wDoc( '<head>' );
wDoc( '<\/head>' );
wDoc( '<body bgcolor="#FFFFFF" topmargin="0"
leftmargin="0">' );
// If there us no Profile selected give them a
message.
if( nSelProf == -1 )
{
wDoc(' <DIV ALIGN="CENTER"><H2>There is no
Profile currently selected.<\/H2><\/DIV>' );
}
else
{
//wDoc( "<div class='enc-acct'>Account<\/
div>" );
//wDoc( "<div class='enc-prod'>Products<\/
div>" );
wDoc( '<BR>' );
wDoc( '<TABLE CELLPADDING="1" CELLSPACING="0"
BORDER="1" ALIGN="CENTER">' );
wDoc( ' <TR>' );
wDoc( '<TH><strong> Account <\/TH>' );
wDoc( '<TH
COLSPAN="2"><strong> Products <\/TH>' );
wDoc( ' <\/TR>' );