HTML Code Not Working When Ebbeded

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
Post Reply
coopfab
Rank 0 - Newcomer
Posts: 3
Joined: Thu Nov 14, 2019 12:09 pm

HTML Code Not Working When Ebbeded

Post by coopfab »

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
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: HTML Code Not Working When Ebbeded

Post by Albert Wiersch »

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>
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
coopfab
Rank 0 - Newcomer
Posts: 3
Joined: Thu Nov 14, 2019 12:09 pm

Re: HTML Code Not Working When Ebbeded

Post by coopfab »

Thanks for the suggestion but it doesn't work. Any other thoughts? Thanks. Michael
coopfab
Rank 0 - Newcomer
Posts: 3
Joined: Thu Nov 14, 2019 12:09 pm

Re: HTML Code Not Working When Ebbeded

Post by coopfab »

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
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: HTML Code Not Working When Ebbeded

Post by Albert Wiersch »

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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Post Reply