[RESOLVED] Setting 'OVERFLOW' to '<not set>'
:confused: Hi all,
I have a DIV panel in an ASPX page. At default it loads with scrollbars (OVERFLOW: auto). If I want the page to print (by clicking a button), I want to delete the OVERFLOW tag, send window.print() and after printing, set the OVERFLOW tag to auto again.
My question: is this possible to do with JavaScript? If Yes, How can I achieve this goal?
Thanx in advance,
JMvV
Re: Setting 'OVERFLOW' to '<not set>'
you might get better results with CSS print media type .
Re: Setting 'OVERFLOW' to '<not set>'
I agree that you should use a specific print stylesheet. But, for the sake of it, here's how you do it using Javascript:
Code:
var mydiv = document.getElementById('something');
mydiv.style.overflow = null;
Re: Setting 'OVERFLOW' to '<not set>'
sure that works? I can't get it to work. Have done this:
Code:
sb.Append("var mydiv = document.getElementById('pnlData');"
sb.Append("mydiv.style.overflow = hidden;")
btnPrint.Attributes.Add("onclick", sb.ToString())
btnPrint is an ImageButton...
it gives me an error, and it posts back... and I don't know what I'm doing wrong.
Re: Setting 'OVERFLOW' to '<not set>'
by the way: read this about css:
Quote:
(Authored by Kevin Venkiteswaran) Part of browsers' poor support for printing includes butchering content that is laid out with anything but position: static. This includes "simple" positioning such as relative and absolute. For example, Win/IE5.0 and Win/IE5.5 would show only the top-most onscreen portion of a <div> that was positioned absolute and had overflow: auto (a CSS setup to emulate HTML frames). Similarly, Mozilla 1.6 had similar problems. The solution was to change all position properties from fixed, absolute, etc. back to static
Re: Setting 'OVERFLOW' to '<not set>'
Quote:
Originally Posted by JMvVliet
sure that works? I can't get it to work. Have done this:
Code:
sb.Append("var mydiv = document.getElementById('pnlData');"
sb.Append("mydiv.style.overflow = hidden;")
btnPrint.Attributes.Add("onclick", sb.ToString())
btnPrint is an ImageButton...
it gives me an error, and it posts back... and I don't know what I'm doing wrong.
What language is that in?
Re: Setting 'OVERFLOW' to '<not set>'
Oh, I'm sorry not to mention that: ASP.NET (VB.NET)...
Re: Setting 'OVERFLOW' to '<not set>'
Could it be...
sb.Append("var mydiv = document.getElementById('pnlData');")
Re: Setting 'OVERFLOW' to '<not set>'
Yeah, you're right, made a mistake in typing and copying the code... I've done it the right way :).
Solved it another way, so I set this post to solved.
Thnx for all the replies.