PDA

View Full Version : Customize Print Button



big-dog1965
12-14-2007, 07:35 AM
Is there a way to make a print button on a page that WILL NOT print the button
Im using Cross-browser print button from DD, but it prints the button
the page is just 1 little image 65x65 and about 10 lines of text plus the print button

jscheuer1
12-14-2007, 09:13 AM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Use the media print style, ex:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" media="print">
#print_but {
display:none;
}
</style>
</head>
<body>
<input id="print_but" type="button" value="Print">
Hi
</body>
</html>

big-dog1965
12-14-2007, 09:54 AM
dont work
does it matter if it a php page

jscheuer1
12-14-2007, 11:54 AM
does too
no it doesn't matter

Please post a link to the page on your site that contains the problematic code so we can check it out.

big-dog1965
12-14-2007, 12:52 PM
test (http://www.wichitarcraceway.com/test.htm)
you will have to fill in required * and click to print. just put anything in the * email field just make sure you put a @ and it should let it go.
the page it takes you to is the 1 I need to print without the button

jscheuer1
12-14-2007, 01:11 PM
Works for me in IE 7, FF 2.0.0.11, and Opera 9.24. Print preview shows no button. There is some problem with the page though. In IE and FF, the print preview shows two pages, the first one is blank, and in at least Opera, the new page loads in already scrolled half way, so that you need to scroll back up to see the button.

Now, what I gave you isn't a print button, just a button styled so that it will not be printed. You said you already had the code for the button that prints, just use this style with it.

big-dog1965
12-14-2007, 01:16 PM
heres the button I was trying
where do or how do I use your code with it
<SCRIPT Language="Javascript">
/*
http://www.dynamicdrive.com/dynamicindex9/other1.htm
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>

jscheuer1
12-14-2007, 03:38 PM
There has to be more to it than that:

Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.