Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print in IE5

Status
Not open for further replies.

askjdhakjdh

Programmer
Joined
Oct 3, 2000
Messages
2
Location
BR
Help...
I made this script,, its a preview page but i can´t print the preview page ...
prev=window.open("","Preview Page")... why???
please test this html page for me... i can´t print what i want... haaaaaaaaaaaaaaaaaaaaaaaaaaa
Im going crazy whith this...

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html>
<head>
<title>Formulario de Pedidos</title>
<Script Language=&quot;JavaScript&quot;>
<!--
file://Function for Form preview
function pegadados()
{
file://Var that keep the values of text fields
var RepRazao = document.pedido.RepRazao.value;
var CliNome = document.pedido.CliNome.value;
var CliRazao = document.pedido.CliRazao.value;
var CliEndereco = document.pedido.CliEndereco.value;
var CliCep = document.pedido.CliCep.value;
var CliBairro = document.pedido.CliBairro.value;
var CliCidade = document.pedido.CliCidade.value;
var CliEstado = document.pedido.CliEstado.value;
var CliFone = document.pedido.CliFone.value;
var CliCGC = document.pedido.CliCGC.value;
var CliIE = document.pedido.CliIE.value;

// Var that keeps a new window,,, (preview results)
var prev = window.open('','Preview');

file://Put some words at nem window(prev)

file://Title
prev.document.write(&quot;<html><head><title>Preview Dados</title></head><body bgcolor=white><br><center>&quot;);


file://Put the form values at the new window(prev)

file://Values
prev.document.write(&quot;<table width=100% border=0><tr><td colspan=4><font size=2>Representante <br>&quot;+RepRazao+&quot;</font></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td colspan=4><font size=2>Cliente <br>&quot;+CliNome+&quot;</font> </td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td colspan=4><font size=2>Razao Social</font><br><font size=2>&quot;+CliRazao+&quot;</font></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td colspan=4><font size=2>Endere&ccedil;o</font><br><font size=2>&quot;+CliEndereco+&quot;</font></td><td colspan=2><font size=2>CEP</font><br><font size=2>&quot;+CliCep+&quot;</font></td></tr><tr><td colspan=2><font size=2>Bairro</font><br><font size=2>&quot;+CliBairro+&quot;</font></td><td colspan=2><font size=2>Cidade</font><br><font size=2>&quot;+CliCidade+&quot;</font></td><td><font size=2>Estado</font><br><font size=2>&quot;+CliEstado+&quot;</font></td><td><font size=2>Fone<br>&quot;+CliFone+&quot;</font></td></tr><tr><td colspan=2><font size=2>CGC</font><br><font size=2>&quot;+CliCGC+&quot;</font></td><td>&nbsp;</td><td colspan=2><font size=2>Inscricao Estadual</font><br><font size=2>&quot;+CliIE+&quot;</font></td><td>&nbsp;</td></tr></table><br><br>&quot;);



file://Button that should print the curent window(prev) but... not print Grrrrrrrrrr
prev.document.write(&quot;<br><br><input type=button name=imprime value=imprime onClick=javascript:self.print();></form></center>&quot;);

}

</script>

</head>
<body>
<form name=&quot;pedido&quot;>
<table width=&quot;100%&quot; border=&quot;0&quot;>
<tr>
<td colspan=&quot;4&quot;><font size=&quot;2&quot;>Representante <br>
<input type=&quot;text&quot; name=&quot;RepRazao&quot; size=&quot;60&quot; maxlength=&quot;50&quot; value=&quot;Logan Fast Slash S/A&quot;>
</font></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan=&quot;4&quot;><font size=&quot;2&quot;>Cliente <br>
<input type=&quot;text&quot; name=&quot;CliNome&quot; value=&quot;Maria&quot;>
</font> </td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan=&quot;4&quot;><font size=&quot;2&quot;>Razao Social</font><br>
<input type=&quot;text&quot; name=&quot;CliRazao&quot; size=&quot;50&quot; value=&quot;Costuras Limpas Ltda&quot;>
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan=&quot;4&quot;><font size=&quot;2&quot;>Endere&ccedil;o</font><br>
<input type=&quot;text&quot; name=&quot;CliEndereco&quot; size=&quot;50&quot; value=&quot;Rua Linha 8, 456&quot;>
</td>
<td colspan=&quot;2&quot;><font size=&quot;2&quot;>CEP</font><br>
<input type=&quot;text&quot; name=&quot;CliCep&quot; value=&quot;9450132&quot;>
</td>
</tr>
<tr>
<td colspan=&quot;2&quot;><font size=&quot;2&quot;>Bairro</font><br>
<input type=&quot;text&quot; name=&quot;CliBairro&quot; value=&quot;ELGIN&quot;>
</td>
<td colspan=&quot;2&quot;><font size=&quot;2&quot;>Cidade</font><br>
<input type=&quot;text&quot; name=&quot;CliCidade&quot; size=&quot;30&quot; value=&quot;Pomba Branca&quot;>
</td>
<td><font size=&quot;2&quot;>Estado</font><br>
<input type=&quot;text&quot; name=&quot;CliEstado&quot; size=&quot;5&quot; value=&quot;PB&quot;>
</td>
<td><font size=&quot;2&quot;>Fone<br>
<input type=&quot;text&quot; name=&quot;CliFone&quot; size=&quot;25&quot; value=&quot;455 6987&quot;>
</font></td>
</tr>
<tr>
<td colspan=&quot;2&quot;><font size=&quot;2&quot;>CGC</font><br>
<input type=&quot;text&quot; name=&quot;CliCGC&quot; size=&quot;25&quot; value=&quot;456789/0001 23&quot;>
</td>
<td>&nbsp;</td>
<td colspan=&quot;2&quot;><font size=&quot;2&quot;>Inscricao Estadual</font><br>
<input type=&quot;text&quot; name=&quot;CliIE&quot; size=&quot;25&quot; value=&quot;789456123&quot;>
</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<table border=&quot;1&quot;>
<div align=&quot;center&quot;>
<input type=&quot;button&quot; name=&quot;Btn_Preview&quot; value=&quot;Ver Pedido&quot; onClick=pegadados()>
</div>
</table>
</form>
</body>
</html>


Please Help...

Thanks [sig][/sig]
 
In your 'print' window you do not have an opening <form> tag enclosing the 'print' button. You do have a closing tag </form>. Try the following change in your function 'pegadados':-

//Title
prev.document.write(&quot;<html><head><title>Preview Dados</title></head><body bgcolor=white><br><center><form>&quot;);

The button should then work properly! :-)


[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top