print from browser -

They have: 2,390 posts

Joined: Nov 1998

Hi all,
I have a slight problem with a javascript that enables me to print articles from a form.
I have the script working in both browsers, but I wanted to change the print button into an image - which I succeeded in with IE4 but for some reason it did not work in N4x.

The script can be found at:
http://www.dynamicdrive.com/dynamicindex11/other1.htm
The code I altered is:
<input type="Image" value="Print this Page" src="images/print.gif" border="0" width="130" height="20" name="Print" onClick="printit()">
...it used to be:
<input type=button value="Print this Page" name="Print" onClick="printit()">

Yours, in anticipation that this anoying problem get sorted ASAP.

PS: I'm off on a two day holiday but will be back Sunday night - please Santa let their be a solution to this.
Have a nice weekend!
JP

------------------
The Webmaster Promotion and Resource Site
www.what-next.com
The NEXT step in Designing and Promoting your Website

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

JP,

Try it this way:

<A HREF="javascript:printit()">
<img src="images/print.gif" border="0" width="130" height="20" name="Print"></A>

I think it will do the trick.

------------------
John Pollock
http://www.pageresource.com

They have: 2,390 posts

Joined: Nov 1998

John (oh beautiful one),
Thanks for the reply, but sadly (I had high hopes ) it does not:

quote:<SCRIPT Language="Javascript">
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
document.write('<form><A HREF="javascript:printit()">
<img src="images/print.gif" border="0" width="130" height="20" name="Print"></A></form>');
}
</script>

...means nothing shows up in IE4 or N4. Did I put it in wrong?
PS might take me a day to get back to you on this one (reasons above ).
JP

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

JP,

I have it working with one of my images ( the image is skewed because I didn't change the width/height values). Here is the url:

http://www.pageresource.com/zzztest/testjp.htm

It may be the document.write statement, be sure the entire document.write(''); statement is on one line..it's hard to tell if it is or not because the forum may force a linebreak where you did not have one. Otherwise I didn't see anything that looked wrong with your code

------------------
John Pollock
http://www.pageresource.com

They have: 2,390 posts

Joined: Nov 1998

John,
Thanks, seems to be working fine now.
http://www.what-next.com/archives/index.html .
If anyone is willing to have a check in several browsers I would appreciate it.

I also found out what the problem was, but am to embarased to say
JP

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Glad to see the script is working for you. It looks like a handy script.

------------------
John Pollock
www.pageresource.com
http://www.javascriptcity.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.