Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3855806
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:49:59+00:00 2026-05-19T17:49:59+00:00

Here is my code: <html> <head> <script type=text/javascript> function displaymessage() { win=window.open(); win.document.write(<html>); win.document.write(<head>);

  • 0

Here is my code:

    <html>
<head>
<script type="text/javascript">
function displaymessage()
{
win=window.open();
win.document.write("<html>");
win.document.write("<head>");
win.document.write("<style type=\"text/css\">");
win.document.write(".vis{visibility:hidden;}");
win.document.write("</style>");
win.document.write("</head>");
win.document.write("<body>");
win.document.write("<table align=\"center\">");
win.document.write("<tr><td>result:</td><td>100,--€</td></tr>");
win.document.write("<tr><td colspan=\"2\" id=\"idcko\"><input type=\"button\" value=\"click\" onclick=\"window.print();vlozenie()\"/></td></tr>");
win.document.write("</table>");
win.document.write("</body>");
win.document.write("</html>");
}
</script>
</head>
<body>
<form>
<input type="button" value="Click me!" onclick="displaymessage();" />
</form>
<script type="text/javascript">
function vlozenie()
{
var y = win.document.getElementById("idcko");
y.innerHTML="<input type=\"button\" value=\"click2\" class=\"vis\"/>";
}
</script>
</body>
</html>

Now I want to print the rendered page, but I want to hide the print button. So is it possible to write some JavaScript functions in an “onclick” event, or may I access the JavaScript function which is located on the mother page?
I found some examples to add “class” attributes for HTML elements:

$("#idcko").addClass("vis");

but it has to be written in JavaScript tags, which I can`t write like this:

win.document.write("<script type=\"text/javascript\">some functions()</script>");

because the rendered page is now incorrect.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:49:59+00:00Added an answer on May 19, 2026 at 5:49 pm

    you can add in your css style @media print and then hide the element that contains the printer icon using display:none

    @media print {
        selectorForPrinterIcon { display:none }
      }
    

    Of course you can follow the same way to hide any other element that you want to be hidden in the printed version. So, there is no need for javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my file omploader.org/vNWJieg/1.png: and this is my code: <!DOCTYPE html PUBLIC -//W3C//DTD
I'm trying to edit this JQuery code to work with a PHP, but for
My google maps API code is not doing the map markers correctly. For some
I found this site/tutorial/demo from another question here on SO. Very nice and clean
I have a html page with some links. When you click on a link,
i have the following map of the world: <!-- copyright (c) 2009 Google inc.
I am trying to replicate Apple's navigational menu bar they use for their primary
OK, I have an Apple-themed nav bar, and for some reason there is some
I'm very newbie to php and codeigniter (and smarty too). I follow a lot
I want to set an attribute of a DOM element using element[attribute] , but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.