Hidding text when printing not working (Javascript)

I have a couple hotspots for “Save”, “Exit” and “Print” that I don’t want to show up when printing. I have this code surrounding the line that contains these links:

<a href="#"

onClick=“printPage(this);”><img src=“/icons/actn147.gif” border=0

alt=“Print page”>

And here is the function:

function printPage()

{

var numDivs = 20;

for(i=1; i<numDivs; i++)

{

	if(document.all['divNoPrint' + i])

	{

		document.all['divNoPrint' + i].style.display = 'none';

	}

}

window.print("");

for(i=1; i<numDivs; i++)

{

	if(document.all['divNoPrint' + i])

	{

		document.all['divNoPrint' + i].style.display = ''; 

	}

} 

}

This code WAS working and now it isn’t. Can anyone tell me if the print command does NOT stop the execution of the “unhide” part of the script? Or better yet, can I make actual buttons and hide them when printing? Thanks for your “eyes”.

Mike

Subject: Hidding text when printing not working (Javascript)

See this article at A List Apart (a great resource you should probably be reading anyway).

Subject: RE: Hidding text when printing not working (Javascript)

Hi Stan. I’m trying to get a hold on CSS, XHTML and Javascript and using it WITHIN Notes all at the same time. My mind is overwhelmed trying to figure out what goes with what and where to put it in Notes to program. My mind is rather numb. It’s causing me to be confused. It also frustrates me a lot because I’ve been coding native Notes for 14 years and can do anything it the Client but when it comes to the web I am lost. It’s probably the way I’m thinking about execution.

Is there a resource that is good that teaches what works, where, in NOTES? I know CSS works but I’m trying to get a handle on how and where to use it. thanks for your help.

Subject: RE: Hidding text when printing not working (Javascript)

Within Notes? There’s not a lot you can do either with CSS or JavaScript to attack this particular problem. Those HTML entities you are looking for aren’t HTML entities and don’t have the properties that HTML entities have – it’s rich text, and needs to be hidden with paragraph hide-whens.

Subject: RE: Hidding text when printing not working (Javascript)

Unless I misunderstand, hide whens for printing don’t work on the web if that paragraph is already displayed, correct? I guess I’m not understanding what you’re talking about hiding paragraphs for the web print function.

I’m also needing to use CSS for formatting the text color and font on my outlines because the Notes definitions aren’t coming through. I’m also using framesets which I’ve heard is old fashioned but I’m not sure how to NOT use them.

I know my client mindset is getting in the way of web mindset. I WILL get this but right now they’re colliding in my head.

Subject: RE: Hidding text when printing not working (Javascript)

Hang on – you said WITHIN NOTES, which I took to mean “in the Notes client”. If it’s a web application, then the article I pointed you to is exactly what you need. All you need to do is give the buttons an id or a class on the HTML tab, then use display: none in the print media CSS. There is absolutely no need to use JavaScript here. A print media stylesheet will also let you get around that annoying thing where a page looks beustiful in the browser but has the rightmost half-inch or so cut off when it’s printed.

Subject: RE: Hidding text when printing not working (Javascript)

I’ve never used that tab before but will experiment. I appreciate your help. My mind is still fuzzy when to use HTML, Javascript, let Notes take care of it, etc. for certain things. I set the size of the field in the help section as I took Domino development back in version 4 but basically haven’t used it much since.