Jump to content

JavaScript Problems


film
 Share

Recommended Posts

Hi, well basicly i want to print a frame of my website using a .gif which is located in a differant frame and when clicked on will print the main frame. I have got :

<IMG src="Print.gif" onclick="top.mainframe.print()">

Im not sure where im going wrong and would like some help if possible.

PS. I know frames are terrible but im still playing around with web deving.

Link to comment
Share on other sites

What you are doing wrong: you are using JavaScript

How you can fix it: Don't use JavaScript

Any good web site shouldn't require JavaScript to work.

I was going to pick on the use of frames which really should be discouraged but he already knew that apparently. But you are right, a page shouldn't require JavaScript to function but I do think it is a great tool to enhance the functionality of a page.

As for doing the printing, I find that the nicest way of doing it is having a normal link to a page (without frames) which is formatted for printing. In that page you have the JavaScript code to print the page run on load, in that way you get around a lot of problems (how different browsers handles frames, printing, etc) and don't require JavaScript to function.

Link to comment
Share on other sites

Admittedly JavaScript is usful if it enhances the page in some way.

Case and point: phpbb doesn't require you have have JavaScript enabled at all, but if you do enable it you get stuff like page auto forwarding, and popups when you get PMs and good stuff like that.

Link to comment
Share on other sites

You could just get away with not having a separate page altogether by using a print style sheet. This Article does a good job of explaining it. So that way the user could just use the print button in the browser. :D

Have you tried that? I'm curious to know if it really works or if it just is another of those practical but ignored standards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...