fsoftball
May 11 2005, 02:56 PM
| | Hi,
Does anyone know how to create a button that will printo out the current page.
What I want to do is have the user fill out a form (containing name, address, zip, etc). They will then click on a "print" button and it will print out the form data. Any ideas?
Thanks. |
Comment/Reply (w/o sign-up)
cragllo
May 11 2005, 03:05 PM
If you know php, then you could make it so that the form data is 'sent' and displayed on a new page, then have print butten (that may be done with javascript, dunno how tho) If you need some help, just ask...
Comment/Reply (w/o sign-up)
fsoftball
May 11 2005, 03:23 PM
Thanks for the help. I can do the PHP part, I get that. It's the sending it to the printer that I would like to know how to do.
Comment/Reply (w/o sign-up)
cragllo
May 11 2005, 04:22 PM
A quick search, and I found this: CODE <script Language="Javascript">
/* This script is written by Eric (Webcrawl@usa.net) For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use, visit dynamicdrive.com */
function printit(){ if (window.print) { window.print(); } else { var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = ""; } } </script>
<script Language="Javascript"> var NS = (navigator.appName == "Netscape"); var VERSION = parseInt(navigator.appVersion); if (VERSION > 3) { document.write('<form><input type=button value="Print this Page" name="Print" onClick="printit()"></form>'); } </script> All tyhe information you need is here, also gives a demo too: http://dynamicdrive.com/dynamicindex9/other1.htm
Comment/Reply (w/o sign-up)
Inspiron
May 16 2005, 03:25 PM
cragllo has given a slightly complicated code... It is broswer sensitive as it test your broswer compatibility before executing the codes... Here's my version, simple and easy to understand... This code loads faster as well... CODE <html>
<head> <title>New Page 1</title> <script language="javascript"> function printpage() { window.print(); } </script> </head>
<body>
<form> <input type="button" value="Print" onclick="printpage();"> </form> </body>
</html>
Comment/Reply (w/o sign-up)
cragllo
May 16 2005, 05:23 PM
That is simple  And all this talk about printing a page has given me an idea, i will add an options bar to my site  You can also use this code instead of the form: CODE <a href="" onclick="printpage();">print</a>
Comment/Reply (w/o sign-up)
Mike
May 19 2005, 07:57 PM
Interesting... All this stuff makes my head explode!  Anyways, I like the window.print() function the best with JavaScript because it's so simple and you basically cannot forget it. But are you sure that you add the semi-colon (  at the end of a function in JavaScript?
Comment/Reply (w/o sign-up)
spacemonkey
May 25 2005, 05:54 PM
You could even omit the Javascript with the function by using the command right from the button: CODE <input type="button" value="Print Page!" onclick="window.print()" />
Comment/Reply (w/o sign-up)
monkeys-r-orange
Jun 13 2005, 12:58 PM
Thank you for helping so many of us. I have always woundered how to allow users to print a page of my website. thanks again.
Comment/Reply (w/o sign-up)
FeedBacker
Feb 6 2008, 05:46 AM
how to print without asking the dialogue box.
Button To Print Current Web Page
I am using the window.Print(); option for printing the current page . Here it is asking me which printer to print ect... In a dialogue box. I want to select the default printer of that machine and print it automatically. -question by honey
Comment/Reply (w/o sign-up)
iGuest
Aug 3 2009, 08:07 AM
HOW TO PRINT DIRECTLY
Button To Print Current Web Page
I need to print the ticket of size 3" x 8". By simply pressing the button Print. Without even displaying any dialog box.
If someone can help that's going to help me.
Thanks in adv
-question by ANAND
Comment/Reply (w/o sign-up)
iGuest
Mar 23 2009, 06:05 PM
The print window function
Button To Print Current Web Page
hey all,
So I have been experimenting with the comman <input type="button" value="Print This Page" onclick="window.Print()">
The website is for my company, it has 2 java graphs and a java spread sheet. (the spread sheet is just a rectangle with lines and numbers filled in)
On my mac, safari prints most of it but not the last half of my spreadsheet.
I get 2 pages with everything on it but the third page is blank safe for the "copyright my_company's_name 2009" at the end.
I have tried loading this on a linux machine at my school and it does not print the Java at all, I get the form buttons and logos and such but no java.
I have noticed some slight differences between my code and the code seen here so I will also mention that this is a Perl file printing out CGI HTML, and linking to Java classes.
Any ideas?
Thanks!
- Tristan
Comment/Reply (w/o sign-up)
iGuest
Oct 9 2008, 03:33 PM
print mutliple pages
Button To Print Current Web Page
Hello, I need to print multiple pages( I.E all the pages in websites). Currently I have 10 html pages in my website. If I click print all the ten pages should print one by one. I used java script to print those pages but it print only one pages " window.Print() " function is used.Try to help me to print all my ten pages at a time. -question by Aswath
Comment/Reply (w/o sign-up)
iGuest
Oct 9 2008, 03:31 PM
print mutliple pages
Button To Print Current Web Page
Hello, I need to print multiple pages( I.E all the pages in websites). Currently I have 10 html pages in my website. If I click print all the ten pages should print one by one. I used java script to print those pages but it print only one pages " window.Print() " function is used.Try to help me to print all my ten pages at a time.
Comment/Reply (w/o sign-up)
iGuest
Sep 1 2008, 06:21 PM
HTML code to print web page
Button To Print Current Web Page
Replying to spacemonkeyDear Spacemonkey, Back in May of 2005, you responded to a question of what HTML code is necessary to print a web page that included "fill in form" features. I was impressed with how simple your coding was. You suggested: <input type="button" value="Print Page!" onclick="window.Print()" /> It works like a charm. I have another question for you now. Is there a simple code that sends the selected web page to someone when they click a "Submit" button. I need to know how to include an email address with that feature. Thanks in advance for any help you can offer. Tom T -question by Tom T
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : button, print, current, web, page
- Multiple Drop Down Menus W/ Submit Button
(9)
Dynamic Button Size
(1) In my application I have a custom tag that generates all the action buttons that the page needs. My
problem is that in IE the space between the left side of the button and the image inside the button
are not consistant. Some buttons have 3 or 4 more pixels of padding on the left side then others.
This causes my buttons to be too large and hence the area the buttons are generated in stretches too
far. I could wrap the buttons around to another line or add scroll bars.. but if it will fit in FF I
think it should fit in IE as well. So my question is can I set the padding....
Refresh Page After Back Button Hit
(14) Hi. I have a page that is dynamically build through DOM manipulation. So, when I browse outside the
page, and then click back, those dynamically created DOM objects are gone. Since I am also using JSP
/ Servlet technology, I can rebuild this page easily, which I have done. Here is my dilemma. If
the user leaves the dynamic page, then clicks back on their browser, I need the page they are going
back to to refresh. I can't figure out how to do this. I've tried using the META tag, but it
won't do it. Help would be appreciated. Thanks. ....
Submit Button
(3) I have a form on my page. I do not have a submit button, but when I hit enter on my text field, it
is like I am clicking on a submit button. My page refreshes to the original state, and my values are
reset. I found this out because I made a submit button and tried it. Is there a way to get around
this? I am trying to use a javascript that captures the key strokes. That works, but then the submit
like event still fires after my code runs, nullifying any changes my code has made. html4strict
Code: CODE 1. 2. 3. 4. ....
Radio Button
(5) I am trying to maintain the radio button selection on a Submit, but the form refreshes to its
default selection. BTW, After a Submit is clicked, the radio form stays visible on the top of the
screen while the query results are displayed on the bottom half of the screen (we're using an
internal, embedded link). That's when the default selection comes into place. Any help would be
appreciated. Please respond Kvarnerexpress.....
Substitute Form Button For An Image
homemade images in forms buttons (3) Hi, I have the next formular : CODE
I want to substitue the add button for an
image CODE that i created but i want still to have the same funcitonlity when someone
clicks. How can i do this? Thanks in advanced!....
Enter Keypress Submits Wrong Button
(2) Ive got a form, with a submit button on the left and a submit button on the right. By default on the
enter keypress, the form submits the left submit button, but i want it to submit the right button.
How would i accomplish this? kvarnerexpress....
Looking for button, print, current, web, page
|
Searching Video's for button, print, current, web, page
See Also,
|
advertisement
|
|