• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DHTML elements not getting printed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,

I am experiencing print issue with dynamic html elements.A javascript function is called on body load to populate dynamic html table.The table is not getting printed on print event.

The elements are displayed in the page but not on the printed paper.
Please help me out!!!

Thanks in advance,
Srinivas Nawab

Here is the javascript function to populate the dynamic table:
------------------------------------------------------------------
function addRowToTable()
{
var tbl = document.getElementById('LegSummaryTable');
var cell;
var contents; //variable to hold reference of created component
var row;
var legSummStr="";
var tkt_delimit="^~";//Ticket separator
var fld_delimit="^*";//Field separator
var rowindex;
var tkt_arr;//to hold the split legSummStr values
var fld_arr;//to hold ticket values
//varfld_arr_next;

//The following code inserts column headers if table row size is zero
if(tbl.rows.length == 0)
{
var oTHead = document.createElement("THEAD");

// Declare stock data that would normally be imported from a stock Web site.
var heading = new Array;
heading[0] = "Account#";
heading[1] = "Account Name";
heading[2] = "Prod Code";
heading[3] = "Txn Date";
heading[4] = "Status";
heading[5] = "Debits";
heading[6] = "Credits";
heading[7] = "Ccy";
heading[8] = ""; // to take care of white spaces..
heading[9] = "";
heading[10] = "";

legSummStr=document.forms[0]['PBFMLAT:LEG_SUMM_DTLS'].value;

tbl.appendChild(oTHead);

// Insert a row into the header and set its background color.
row = document.createElement("TR");
row.align="left";
oTHead.appendChild(row);

if(legSummStr != "")
{
for (i=0; i<heading.length; i++)
{
contents = document.createElement("TH");
contents.innerHTML = "<span><FONT class='txt' WEIGHT=bold>"+heading[i]+"</FONT></span>";
row.appendChild(contents);
}
}
row = tbl.insertRow();
for (k=0; k<heading.length; k++)
{
cell=row.insertCell();
contents = document.createElement("HR");
cell.appendChild(contents);
}
}

tkt_arr = legSummStr.split(tkt_delimit);

for(i=0;i<tkt_arr.length-1;i++)
{
fld_arr=tkt_arr[i].split(fld_delimit);

rowindex=tbl.rows.length;
row = tbl.insertRow(rowindex);
var count=fld_arr.length-1;
var legID=fld_arr[0];//Which holds legID

var acc_type=fld_arr[12];
var tkt_id=fld_arr[13];
var minLegDate=fld_arr[14];

for(j=0;j<(fld_arr.length-4);j++)
{
if(fld_arr[j+1] == "Edit")
{
cell = row.insertCell(j);
contents = document.createElement("TD");
contents.id=tbl+i+"field"+j;
contents.innerHTML="<span><FONT style='word-wrap: break-word; width:30;' class='txt' WEIGHT=bold><a href=javascript:winLegEdit("+legID+")>"+fld_arr[j+1]+"</FONT></span>";
}
else if(fld_arr[j+1] == "Delete")
{
cell = row.insertCell(j);
contents = document.createElement("TD");
contents.id=tbl+i+"field"+j;
contents.innerHTML = "<span><FONT class='txt' WEIGHT=bold><a href=javascript:winLegDelete("+legID+")>"+fld_arr[j+1]+"</FONT></span>";
}
else if(fld_arr[j+1] == "View")
{
cell = row.insertCell(j);
contents = document.createElement("TD");
contents.id=tbl+i+"field"+j;
contents.innerHTML = "<span><FONT style='word-wrap: break-word; width:30;' class='txt' COLOR=#000000 WEIGHT=bold><a href=javascript:winTktView('"+legID+"','"+acc_type+"','"+tkt_id+"')>"+fld_arr[j+1]+"</FONT></span>";
}
else
{
cell = row.insertCell(j);
contents = document.createElement("TD");
contents.id=tbl+i+"field"+j;
contents.innerHTML ="<span><FONT style='word-wrap: display: width:40;' class='txt' WEIGHT=bold>"+fld_arr[j+1]+"</FONT></span>";
}
cell.appendChild(contents);
count=count-1;
}//end of inner for loop

if(tkt_id == 2)
{
row = tbl.insertRow();

for (k=0; k<heading.length; k++)
{
cell=row.insertCell();
contents = document.createElement("HR");
cell.appendChild(contents);
}
}

}//end of outer loop

}
-----------------------------------------------------------------------
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic