HTML Code Not Working When Ebbeded

Discussion about HTML and XHTML related issues.
Post Reply
coopfab
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 3
Joined: Thu Nov 14, 2019 12:09 pm

HTML Code Not Working When Ebbeded

Post by coopfab » Thu Nov 14, 2019 12:18 pm

Good afternoon:

This small html code works when run alone in my browser but not when it's embedded in our website. In the website, the print button "is hot" to the mouse pointer but it doesn't bring up the printer function.

<html>

<script>
function printpage()
{
window.print();


}
</script>
<body>
<p> Please print and fill out donation slip and mail with your donation. Thanks.</p>

<button onclick="printpage()">PRINT</button>
</body>
</html>

Any help you can give would be much appreciated. Thanks. Michael

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3453
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: HTML Code Not Working When Ebbeded

Post by Albert Wiersch » Thu Nov 14, 2019 12:37 pm

Maybe a conflict with the function name printpage and another function or variable?

Does this work?

Code: Select all

<button onclick="window.print()">PRINT</button>
Image
Albert Wiersch

coopfab
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 3
Joined: Thu Nov 14, 2019 12:09 pm

Re: HTML Code Not Working When Ebbeded

Post by coopfab » Thu Nov 14, 2019 4:06 pm

Thanks for the suggestion but it doesn't work. Any other thoughts? Thanks. Michael

coopfab
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 3
Joined: Thu Nov 14, 2019 12:09 pm

Re: HTML Code Not Working When Ebbeded

Post by coopfab » Thu Nov 14, 2019 4:34 pm

Hello Albert. Just found this out. We're using Google Sites and they do not allow popup windows! So, a print button will never work. Thanks for your help and I really appreciate your time and efforts. Regards, Michael

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3453
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: HTML Code Not Working When Ebbeded

Post by Albert Wiersch » Thu Nov 14, 2019 6:53 pm

coopfab wrote:
Thu Nov 14, 2019 4:34 pm
Hello Albert. Just found this out. We're using Google Sites and they do not allow popup windows! So, a print button will never work. Thanks for your help and I really appreciate your time and efforts. Regards, Michael
You're welcome!

I had also thought that something might be blocking it.

Thank you for posting back with what you found.
Image
Albert Wiersch

Post Reply