This is a multi-part message in MIME format.
------=_NextPart_000_0000_01C178BB.25E88F20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Thanks Daniel. That put me on the right track!
Larry Guayante
Knowledge Outlook
"performance, process, and learning solutions"
xxx.xxx.xxxx
larry@k...
-----Original Message-----
From: DANIEL RADU [mailto:radudanielro@y...]
Sent: Monday, November 26, 2001 5:16 AM
To: javascript
Subject: [javascript] Re: Strip Images From Print Output
The "printer friendly version" you want to create should contain the
document of the page you want to print without images. The document object
model contains a collection named images. You could navigate through the DOM
and avoid displaying images.You should identify your images by an ID or by
name.
Get the all collection and the images collection. Compare each item of
these collection. If the document.all collection contain an item from the
document.images collection you should not to transfer into the "printer
friendly version"..
Antoher way is to navigate through the DOM and check the tag of the
current element. If the tag is anything else then "IMG" or what else you
don't want to print you could display this element. (I guess this is a
better idea because you'll do only a navigation not two like in images
example.
To obtain the content of a element you should only get the innerText or
innerHTML property value and your new object will look the same as the
initial document.
An example:
...
<script>
function fPrint()
{
window.open("printer_friendly_version.htm");
}
</script>
<button onclick="fPrint()">Printer friendly version</button>
...
The printer_friendly_version.htm page should be empty, but on onload event
it should execute this code:
...
<script>
function fLoad()
{
for(i = 0; i < window.opener.document.all.length; i++)
{
if(window.opener.document.all(i).tagName != "IMG")
{
var oElem
document.createElement(window.opener.document.all(i).tagName);
document.body.appendChild(oElem);
}
}
}
</script>
<body onload="fLoad()">
</body>
...
Good luck!
Larry Guayante <larryg@k...> wrote:
I think I just need some general direction. I want to create a "printer
friendly version" of an html document that does not include the images.
Is
there a way to use the DOM and Javascript/asp to strip the image tags?
Larry Guayante
Knowledge Outlook
"performance, process, and learning solutions"
xxx.xxx.xxxx
larry@k...
$subst('Email.Unsub')
----------------------------------------------------------------------------
--
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. ---
You are currently subscribed to javascript as: larryg@k... To
unsubscribe send a blank email to $subst('Email.Unsub')