W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

DOM code works in IE5 not IE4

From: <wendy_lee@agilent.com>
Date: Mon, 10 Jul 2000 21:46:15 -0600
Message-ID: <C54D0FE42492D31198C8009027AA6430DE079B@axatl04.atl.hp.com>
To: www-dom@w3.org
Hi,

I've set up some HTML pages such that every top-level heading (<H1>) starts
printing at the top of a page -- the .CSS file defines <H1> with
"page-break-before: always". But, this throws a blank page before every
printout (since <H1> is almost always the first paragraph printed). So, I
introduced this Javascript, which uses DOM to strip away any leading blank
pages from an HTML page:

   function AdjustPageBreaks()          
   {         
      var TitleCollection = document.all.tags( "H1" );         
      if( document.body.innerText.indexOf(TitleCollection[0].innerText ) ==
0 )          
      {         
         TitleCollection[0].style.pageBreakBefore = "auto";          
      }         
   }         

This works fine in IE5 but not IE4. Can anyone tell me why or suggest
something that works in IE4 as well?

Thanks,
Wendy.
Received on Monday, 10 July 2000 23:46:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT