Problems with PrintReady javascript and published Frontpage 2003 web site

  • Thread starter Eduardo Márquez-Blake
  • Start date
E

Eduardo Márquez-Blake

Hello,

I'm building a frontpage web site and I'm testing it in
http://frontpage.sobrenatural.net

I'm using a script from here
(http://javascript.about.com/library/scripts/blprintready.htm) that will
allow my visitors to click on a link an see and print a new document with
just the text that I have included between <div id="printReady"> and </div>
tags. In my computer it works perfectly, it opens a new document and writes
the contents of those tags. But now that I've published using MS FrontPage
2003, it doesn't seem to work. In fact, when I click on the print script
link it opens a new windows and my browser freezes. I also tried it on two
other computers here and it freezes the Internet Explorer Browser and the
Avant Browser in them.

At firs, I thought the problem was the Frontpage Web Bot counter that I put
in them (to check how many times each of my articles have been read), but I
move one of them outside of the <div> tag in this page
(http://frontpage.sobrenatural.net/contenido/secciones/curanderismo/articulo
-1.htm) and the problem persists.

Since my web site is in spanish language, I'm giving you the urls you may
visit to reproduce the error. If you navigate to
(http://frontpage.sobrenatural.net/contenido/secciones/index.htm), you
should see some text that reads "Lista de Todos los Artículos disponibles:",
under it, you should see a list of several pages. Please click on any of
them and when it opens, you'll see the article. Now please scroll down and
on the left margin you should see a box that reads "Opciones" and then an
icon with a printer with the label "Imprime este artículo". That's the link
to the script, but the actual script is in a separate file that you may
download here (http://frontpage.sobrenatural.net/js/printready.js).

So, as you may see, the problem is that I can't seem to figure out why this
script does not work after it has been published, but it do work on my local
hard drive.

A word of CAUTION: If you click on the "Imprime este artículo" link, your
browser will open a new window that may freeze all of your browser's
windows. You may have to shut down your browser enterely and reload it
again.

By the way, I'm not a professional web developer, I'm just a humble studio
photographer with a lot of spare time ;-)

I will appreciate any help on this. Thanks in advance.

Sincerely,

Lalo Márquez
www.sobrenatural.net
 
G

Guest

Hi Eduardo,

Your page has a lot of code to wade through.

How about creating a simple page, no bells and whistles, with just a simple paragraph for printing. Let's see if we can make it work on a new page.

One of the things I noticed, was a lot of extra file slashes associated with your images.

I checked the HTML source for this page
El "ovni" en el libro "Bonnes Moeurs"

I didn't see the <Head> script provided with the Print Ready Script. Maybe I missed something, as I am very tired. It definitely will require the <Head> script on every page you wish to print content with this method.

I think it would be simpler to try a new page to see if you can get it working.

I recommend this script and haven't had anyone come back and say it doesn't work.



Mike Smith,

http://FrontPageForms.com
FrontPage Form Tutorials
& Form Script Examples

If you found my post helpful, please take a sec to click
the "Yes" button. I'm in it for the glory.
 
S

Stefan B Rusynko

Don't edit scripts you don't understand (-;

In your script delete the 5 lines you have added between
printWin.document.open();
and
printWin.document.close();

All you should have is
printWin.document.open();
printWin.document.write(html);
printWin.document.close();

If you are attempting to add content to the printed page you need to add it to the variable "html" after the line which starts your
printed page content
html += '\n</HE' + 'AD>\n<BODY>\n';
or before / after the line that adds your page content (from the <div id="printReady"> section)
html += printReadyElem.innerHTML;
but before the line which closes the page at
html += '\n</BO' + 'DY>\n</HT' + 'ML>';
Using
html +=
to add to the "html" string w/ proper syntax
Then Test in Browser (not FP preview) before you publsih

The actual line that generates ALL your html for the printed page is
printWin.document.write(html);

PS
You also have some illegally nested <p> tags at:
http://frontpage.sobrenatural.net/contenido/secciones/escepticismo/articulo-6.htm
Like
<P align=right style="text-align: right">&nbsp;</P></p>
<p><p style="text-align: center" class="copyright
and make sure you close the last block tag w/ a (</p>) before the </div>

- validate your page html





| Hello,
|
| I'm building a frontpage web site and I'm testing it in
| http://frontpage.sobrenatural.net
|
| I'm using a script from here
| (http://javascript.about.com/library/scripts/blprintready.htm) that will
| allow my visitors to click on a link an see and print a new document with
| just the text that I have included between <div id="printReady"> and </div>
| tags. In my computer it works perfectly, it opens a new document and writes
| the contents of those tags. But now that I've published using MS FrontPage
| 2003, it doesn't seem to work. In fact, when I click on the print script
| link it opens a new windows and my browser freezes. I also tried it on two
| other computers here and it freezes the Internet Explorer Browser and the
| Avant Browser in them.
|
| At firs, I thought the problem was the Frontpage Web Bot counter that I put
| in them (to check how many times each of my articles have been read), but I
| move one of them outside of the <div> tag in this page
| (http://frontpage.sobrenatural.net/contenido/secciones/curanderismo/articulo
| -1.htm) and the problem persists.
|
| Since my web site is in spanish language, I'm giving you the urls you may
| visit to reproduce the error. If you navigate to
| (http://frontpage.sobrenatural.net/contenido/secciones/index.htm), you
| should see some text that reads "Lista de Todos los Artículos disponibles:",
| under it, you should see a list of several pages. Please click on any of
| them and when it opens, you'll see the article. Now please scroll down and
| on the left margin you should see a box that reads "Opciones" and then an
| icon with a printer with the label "Imprime este artículo". That's the link
| to the script, but the actual script is in a separate file that you may
| download here (http://frontpage.sobrenatural.net/js/printready.js).
|
| So, as you may see, the problem is that I can't seem to figure out why this
| script does not work after it has been published, but it do work on my local
| hard drive.
|
| A word of CAUTION: If you click on the "Imprime este artículo" link, your
| browser will open a new window that may freeze all of your browser's
| windows. You may have to shut down your browser enterely and reload it
| again.
|
| By the way, I'm not a professional web developer, I'm just a humble studio
| photographer with a lot of spare time ;-)
|
| I will appreciate any help on this. Thanks in advance.
|
| Sincerely,
|
| Lalo Márquez
| www.sobrenatural.net
|
|
| ---
| Este mensaje fue certificado Libre de Virus al ser Enviado.
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.719 / Virus Database: 475 - Release Date: 16/07/2004
|
|
 
L

Lalo Márquez

Hi Mike,

Thanks a lot for your reply! I'm trying to design this site like my original
site (you can check it out here http://www.sobrenatural.net) that uses
PhpNuke, since it's been hacked several times (I'm hoping that my new
frontpage site won't be that vulnerable to hacking), so I'm copying all my
articles from my phpnuke site and pasting them directly on my frontpage
pages, and I'm thinking that maybe that's way there's a lot of "garbage"
code in my pages :-?

The script for the PrintReady is just above the <body> tag, is written like
this:

</script>
<script language="javascript" src="../../../js/printready.js"><!--
PrinterFriendly Text --></script>
</head>

If there's something wrong with the script, it must be my fault since I
messed around with it a bit <:-o

Thank you again for your time!

With my best regards,

Eduardo Marquez-Blake



FrontPageForms said:
Hi Eduardo,

Your page has a lot of code to wade through.

How about creating a simple page, no bells and whistles, with just a
simple paragraph for printing. Let's see if we can make it work on a new
page.
One of the things I noticed, was a lot of extra file slashes associated with your images.

I checked the HTML source for this page
El "ovni" en el libro "Bonnes Moeurs"

I didn't see the <Head> script provided with the Print Ready Script. Maybe
I missed something, as I am very tired. It definitely will require the
 
L

Lalo Márquez

Hi Stefan!

You're absolutely right!! I haven't checked it yet but what your saying
makes a lot of sense so I'm betting that will fix it! As I said before, I'm
just a photographer with some spare time in my hands and I love to make web
sites, so I don't know how to code scripts in any language, but I feel that
sometimes I can get some sense of the codes and, before this one, I had been
able to find the problems for myself. But this time I just couldn't do it
alone, so I thank you all of you guys who took the time to help me. I really
really appreciate it a lot.

I'm on my way to check the code and do the proper modifications and see how
it goes.

I sincerely send you my best regards,

Eduardo Marquez-Blake




----- Original Message -----
From: "Stefan B Rusynko" <[email protected]>
Newsgroups: microsoft.public.frontpage.client
Sent: Sunday, August 01, 2004 3:25 AM
Subject: Re: Problems with PrintReady javascript and published Frontpage
2003 web site


Stefan B Rusynko said:
Don't edit scripts you don't understand (-;

In your script delete the 5 lines you have added between
printWin.document.open();
and
printWin.document.close();

All you should have is
printWin.document.open();
printWin.document.write(html);
printWin.document.close();

If you are attempting to add content to the printed page you need to add
it to the variable "html" after the line which starts your
 
L

Lalo Márquez

Stefan,

That was it! It seems to be working flawless! Thank you again!
I have one more question... if I use the Tools->Optimize HTML... function in
FrontPage 2003, could it damage the code or just cleans it up? Will that
work for validating and closing my open tags?

Best regards,

Eduardo Marquez-Blake



Stefan B Rusynko said:
Don't edit scripts you don't understand (-;

In your script delete the 5 lines you have added between
printWin.document.open();
and
printWin.document.close();

All you should have is
printWin.document.open();
printWin.document.write(html);
printWin.document.close();

If you are attempting to add content to the printed page you need to add
it to the variable "html" after the line which starts your
 
R

Ronx

Tools - Optimise HTML can destroy code if over used. Removing leading
whitespace is usually safe, but the other options, especially removing *all*
whitespace and/or HTML comments, can render some code useless.

Tools - Optimise HTML will not validate HTML or repair any broken tags, or
close open tags.

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top