codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  no print button on the paper  luca90 at 09:48 on Tuesday, September 09, 2003
 

from this code is possible no printed the java button on paper?



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Visualizzazione Dettaglio Dati</title>
</head>

<%
Set ObjDB = Server.CreateObject("ADODB.Connection")
Set ObjRS = Server.CreateObject("ADODB.Recordset")

ObjDB.ConnectionTimeout = 60
ObjDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("./tabella2.mdb") & ";"
ObjDB.CommandTimeout = 0

id = Request.QueryString("Contratto")

ObjRS.CursorLocation = 3
ObjRS.ActiveConnection = ObjDB
ObjRS.Open "SELECT * FROM Tabella2 WHERE numcontratto='" & id & "'"

%>


<body bgproperties="fixed" link="#000000" vlink="#000000" alink="#000000" topmargin="0">
<p align="center"><font face="Verdana" size="2" color="#0000FF"><b><br>
Visualizzazione
Dettaglio Dati
</b></font></p>
<div align="center">
<table border="0" width="548">
<tr>
<td align="right" width="275">

<script Language="JavaScript">

<!--



// Funzioni per il roll-over, la data e l'ora



// Common variables

today=new Date();



// Browser Detection

browser_name = navigator.appName;

browser_version = parseFloat(navigator.appVersion);

if (browser_name == "Netscape" && browser_version >= 3.0)

{ roll = 'true'; }

else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 4.0)

{ roll = 'true'; }

else

{ roll = 'false'; }




// Months and Days arrays (english version)

var EisnMonths=new isnArray("January","February","March","April","May","June","July","August","September","October","November","December");

var EisnDays= new isnArray("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");

EisnDays[0] = EisnDays[7]



// Months and Days arrays (italian version)

var IisnMonths=new isnArray("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");

var IisnDays= new isnArray("Lunedi","Martedi","Mercoledi","Giovedi","Venerdi","Sabato","Domenica");

IisnDays[0] = IisnDays[7]



// Month and Days Array initializer

function isnArray()

{

argnr=isnArray.arguments.length

for (var i=0;i<argnr;i++) {

this[i+1] = isnArray.arguments;

}

}



// Write today's date

function date_today(lang)

{

if (lang=="E") // english format

{

if (today.getYear()<=99) {nyear="19"} else {nyear=""}

document.write(EisnDays[today.getDay()]+" "+EisnMonths[today.getMonth()+1] +" "+today.getDate()+" "+ nyear + today.getYear());

}

if (lang=="I") // italian format

{

if (today.getYear()<=99) {nyear="19"} else {nyear=""}

document.write(IisnDays[today.getDay()]+" "+ today.getDate()+ " " +IisnMonths[today.getMonth()+1] +" "+ nyear + today.getYear());

}

}



// On mouse_over and mouse_out (swap images)

function mOver(img,ref) { if (roll == 'true' { img.src=imglist[ref]+dwsfx } }

function mOut(img,ref) { if (roll == 'true' { img.src=imglist[ref]+upsfx } }



//-->

</script>
<p align="left"><font face="Verdana" size="1"><b><script LANGUAGE="JavaScript"> date_today ("I");</script>
</b></font>
</td>
<td align="right" width="255">
<input type="button" onClick="this.style.visibility='hidden'; window.print();" value="Stampa Scheda" style="font-family: Verdana; font-size: 8 pt; float: right">
</td>
</tr>
</table>
</div>
<div align="center">
<center>
<table border="0" width="72%">
<tr>
<td>
<hr size="1" color="#0000FF" width="542"></td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>

<table cellspacing="0" cellpadding="2" border="0" class="myStyle_TABLE" width="542">
<tr class="myStyle_INTESTAZIONE">
<td width="201" bgcolor="#66CCFF"><font face="Verdana" size="1">Data
Censimento</font></td><td width="327" bgcolor="#66CCFF"><font face="Verdana" size="1"><%=ObjRS("data")%></font></td>
</tr>
<tr class="myStyle_INTESTAZIONE">
<td width="201"><font face="Verdana" size="1">Firmatario</font></td><td width="327"><font face="Verdana" size="1"><%=ObjRS("cognomefirmatario")%> <%=ObjRS("nomefirmatario")%></font></td>
</tr>

<tr class="myStyle_INTESTAZIONE">
<td width="201" bgcolor="#66CCFF"><font face="Verdana" size="1">Data di
Nascita</font></td><td width="327" bgcolor="#66CCFF"><font face="Verdana" size="1"><%=ObjRS("datadinascita")%></font></td>
</tr>
<tr class="myStyle_INTESTAZIONE">
<td width="201"><font face="Verdana" size="1">Nr. Contratto</font></td><td width="327"><font face="Verdana" size="1"><%=ObjRS("numcontratto")%></font></td>
</tr>
<tr class="myStyle_INTESTAZIONE">
<td width="201" bgcolor="#66CCFF"><font face="Verdana" size="1">Codice
Fiscale</font></td><td width="327" bgcolor="#66CCFF"><font face="Verdana" size="1"><%=ObjRS("cf")%></font></td>
</tr>
<tr class="myStyle_INTESTAZIONE">
<td width="201"><font face="Verdana" size="1">Nr. Smartcard</font></td><td width="327"><font face="Verdana" size="1"><%=ObjRS("numsmartcard")%></font></td>
</tr>

</table>

</center>
</div>

<div align="center">
<table border="0" width="72%">
<tr>
<td>
<hr size="1" color="#0000FF" width="542"></td>
</tr>
</table>
<input type="button" onClick="self.close()" value="Chiudi" style="font-family: Verdana; font-size: 8 pt">

<center>
</center>
</div>

<div align="center">
<center>
<table border="0" width="556">
<tr>
<td width="548">
<p align="right"><font face="Verdana" size="1">By S. Imparato A.T.C.B.
</font></td>
</tr>
</table>
</center>
</div>

<script language="javascript">
window.focus();
</script>

</body>
</html>


  Re: no print button on the paper  Troy Wolf at 14:52 on Tuesday, September 09, 2003
 

Luca90, You don't need to post your entire code. Try to just paste the relevant parts. Most people are not going to take the time to figure out your entire program anyway.

It looks like you are on the right track. I have accomplished this in the past using about the same method you are. The print button fires a javascript function that first sets the button visibility to hidden, then does the print, then sets the button visibility back to visible.

This code shows this technique in action. Just save this as a new HTML page, then open it. When you click the button and print the page, you should not see the button on the printout.
<script language="javascript">
function DoPrint()
{
document.all("cmdPrint").style.visibility = "hidden";
window.print();
document.all("cmdPrint").style.visibility = "visible";
}
</script>
<body>
Print this page contents by clicking the Print button.
<p>
The button should not print.
<p>
<input id="cmdPrint" type="button" value="Print this page" onclick="DoPrint()">
</body>

Also, you mention a "java" button. Did you mean "javascript"? Java and javascript are not related languages. (Visual Basic and VBScript are.)

Hope this helps, Luca90!
Troy Wolf: site expert
SnippetEdit Website Editor









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  How do you create....
•  Re: Import Excel File to sql server database...
•  automation of Word Mail Merge
•  Re: Filepointer in Perl
•  Re: dynamic crystal report generation
•  Data transfer from DB2 to Sybase using Perl?
•  is there other ways to get data out from excel using ASP.NET
•  Re: Array manipulations
•  ASP+Bar Code


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006