Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_objects thread: parsing HTML tags


Message #1 by avishkarm@y... on Fri, 26 Oct 2001 11:18:15
Not that I know, at least.
But you can parse the innerHTML you get, to remove unwanted tags.

For example:

function getInnerHTML()
{ 
   document.frmExcel.hdnHTML.value = new
String(document.body.innerHTML).replace(/<\/?tbody>/gi, "");  // this
removes all start and end tbody tags
   //frmExcel is the form name, hdnHTML is name of type
}



/Robert


-----Original Message-----
From: avishkarm@y... [mailto:avishkarm@y...] 
Sent: den 26 oktober 2001 13:18
To: JavaScript Objects
Subject: [javascript_objects] parsing HTML tags


I am using following function to get HTML table data in hidden type and 
printing it in excel worksheet.
But for some HTML tables , it is also printing other data also.
Can I use something other that body in document.frmExcel.hdnHTML.value = 
document.body.innerHTML

<Script language="javascript">
function getInnerHTML()
{ 
   document.frmExcel.hdnHTML.value = document.body.innerHTML;
   //frmExcel is the form name, hdnHTML is name of type
}
</Script>
<form method="POST" action=make_excel.asp name="frmExcel">
<input type="hidden" name="hdnHTML">
<input type="submit" value="Print in Excel" onClick ="getInnerHTML();">
</form>

Thanks in Advance.
Avishkar Meshram 
ICICI Infotech,Mumbai 


  Return to Index