• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

HTML Printing issues

stebesplace

Senior member
Ok this is going to be in depth:

I want to print a page of html, but certain elements to be taken out of the printing.

Here is the javascript i am using:

<script language="JavaScript">
function removeelements(){
//store all elements with id=remove to "remove_el"
var remove_el=document.all.remove
//if there is only one element with id=remove
if (remove_el!=''&&remove_el.length==null)
remove_el.style.display='none'
else{
for (i=0;i<remove_el.length;i++)
remove_el.style.display='none'
}
document.body.style.background=''
}
function revertback(){
setTimeout("window.location.reload()",50)
}
window.onbeforeprint=removeelements
window.onafterprint=revertback
</script>


Ok, so now I place the id="remove" at a table I have, and yes, as expected, it removes the data.

However, one element is not removed and I belive because it is using the <div> tag. Let me explain.

I have a drop down menu with the following code. This menu is in the upper table with other elements:

<tr>
<td width="765" bgcolor="#C0C0C0" align="left" valign="top" height="30" colspan="2">
<p align="center">




<div id='MenuPos' style='position:relative; width:765px; height:30px;'>


<script type='text/javascript'>function Go(){return}</script>
<script type='text/javascript' src='script/RelativePositioned_var.js'></script>
<script type='text/javascript' src='script/menu9_com.js'></script>
<noscript>Your browser does not support script</noscript>

</div>

</td>
</tr>


As you can see, it calls javascript files with the data for the menu.

Now what is happening here is that I go to print, and it takes out the whole upper table of information, and only prints the main body text, but still leaves this menu graphic, and operating menu, which tells me that its bypassing this menu for some reason, even though it is in the <table> which is given the id tag to be removed with printing.

Can someone explain how I can fix this so it does not print this menu?

Thank you,

-Steve
 
Back
Top