Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
print ?
lm489
is it possible for to print certain body of the page as the user doesn't want navigation and only wants to print body content,
i did try to print with javascript code below but it prints the whole page
if (window.print) {
document.write('<form action="0">'
+ '<input type=button name=print value="Print This Page" '
+ 'onClick="javascript:window.print()"></form>');
}
is there anyway we could only print body content
Find more posts tagged with
Comments
Gregg Faus
If you are trying to make this cross browser compatible then I wouldn't suggest this approach. A cross browser approach would use a separate printable HTML document.
To do this I use a server-side script and strip out all text except the body content.
This can be achieved by putting starting and ending HTML comments like so:
<!-- BEGIN CONTENT -->
printable content is here
<!-- END CONTENT -->
Then use these tags to correctly find the text that is printable and parse it out.
If you need such a script I created one for ASP. Not sure what your web server environment is.
If this page is templated, another approach would be to create two documents when the DCR is generated. But this approach creates double the amount of content.
gf
ts_user
Why not have a CGI callout (print body) for the body text box. When the user clicks on the CGI callout, let the CGI format the page with the body content and use the standard browser print functionality.
~ts_user