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. |
Reply
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...
Reply
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.
Reply
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
Reply
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>
Reply
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>
Reply
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?
Reply
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()" />
Reply
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.
Reply
iGuest
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
Reply
Latest Entries
tefanclub
Mar 7 2008, 12:12 PM
thanks
Reply
galexcd
Feb 6 2008, 06:44 PM
Of course you couldn't print without displaying the box first. If javascript had that kind of power could you imagine the abuse websites could do? Print out 40 pages of pure black while your surfing the net and you wouldn't even know until you hear the printer going. QUOTE(delivi @ Feb 6 2008, 08:36 AM)  This will work in IE, FF & Opera but not in safari It works fine in safari.
Reply
delivi
Feb 6 2008, 04:36 PM
I a simple link with this code is enought to print the content of the page CODE <a href="java script:print();">Print this Page</a> This will work in IE, FF & Opera but not in safari
Reply
Recent Queries:--
php page print - 5.82 hr back. (1)
-
php print button code - 7.94 hr back. (1)
-
print web page php - 11.87 hr back. (1)
-
make button to print a page with out the button - 13.84 hr back. (1)
-
print page php - 14.66 hr back. (2)
-
php print page - 14.67 hr back. (2)
-
php print new page - 26.59 hr back. (1)
-
create print button php - 26.95 hr back. (1)
-
php print a page automatically - 28.02 hr back. (1)
-
php print this page - 1.82 hr back. (3)
-
php print page to printer code - 31.23 hr back. (1)
-
"print web page" php - 31.27 hr back. (1)
-
how to print a web page in php - 31.85 hr back. (1)
-
create print button for html page - 32.52 hr back. (1)
Similar Topics
Keywords : button, print, current, web, page
- Multiple Drop Down Menus W/ Submit Button
(6)
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
(11) 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. <form name="FormPictureInfo"> 2.....
Radio Button
(4) 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 <form method='post'
action='index.php?mode=2&id=1'> <input type='hidden'
name='name' value='Canon Digital Ixus 700'/> <input
type='hidden' name='id' value='1'/> <input
type='hidden' name='qty' value='1'> <input
type='hidden' name='cost' value='40'> <input
type='submit' value='Add to ca....
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
|
advertisement
|
|