|
-
April 12th, 2007, 12:47 PM
#1
how to display results in another html window
I am trying to display information from my text boxes to another html window (pop up). using the print button. Does anybody have examples for this.
Attached code
Code:
<HTML>
<head>
<TITLE>Competition</TITLE>
<style>
table
{
border:7px double #808080;
width:10%;
background-color:#f0f0f0;
}
th
{
font-family:Verdana;
font-size:12px;
color:#0979ff;
background-color:#cccccc;
text-align:center;
}
td
{
text-align:left;
}
.w32{width:32px;}
.w42{width:42px;}
.w45{width:45px;}
.w55{width:55px;}
.w123{width:123px;}
.w70{width:70px;}
.inps
{
font-family:Arial;
font-size:14px;
font-weight:500;
text-align:center;
color:#000000;
background-color:#ffffff;
}
</style>
<script>
function calculation()
{
if(document.getElementById("in11").value && document.getElementById("in15").value)
{
document.getElementById("in16").value = Math.abs(document.getElementById("in11").value) +
Math.abs(document.getElementById("in15").value);
var Index1 = document.getElementById("in3").selectedIndex;
if(Index1 == 1)
{
// for men
document.getElementById("in17").value = document.getElementById("in16").value* Math.pow(10,0.845716976 *
(Math.pow(Math.log(document.getElementById("in7").value / 168.091) / Math.log(10),2))) ;
}
if( Index1 == 2)
{
// for female
document.getElementById("in17").value = document.getElementById("in16").value* Math.pow(10,1.316081431 *
(Math.pow(Math.log(document.getElementById("in7").value / 107.844) / Math.log(10),2))) ;
}
}
if(document.getElementById("in25").value && document.getElementById("in29").value)
{
document.getElementById("in30").value = Math.abs(document.getElementById("in25").value) +
Math.abs(document.getElementById("in29").value);
}
if(document.getElementById("in41").value && document.getElementById("in45").value)
{
document.getElementById("in46").value = Math.abs(document.getElementById("in41").value) +
Math.abs(document.getElementById("in45").value);
}
if(document.getElementById("in57").value && document.getElementById("in61").value)
{
document.getElementById("in62").value = Math.abs(document.getElementById("in57").value) +
Math.abs(document.getElementById("in61").value);
}
if(document.getElementById("in73").value && document.getElementById("in77").value)
{
document.getElementById("in78").value = Math.abs(document.getElementById("in73").value) +
Math.abs(document.getElementById("in77").value);
}
if(document.getElementById("in89").value && document.getElementById("in93").value)
{
document.getElementById("in94").value = Math.abs(document.getElementById("in89").value) +
Math.abs(document.getElementById("in93").value);
}
}
function print()
{
// window.open('dummydoc.htm', 'Results',
//'location=yes,toolbar=yes,menubar=yes,directories=yes,status=yes,resizable=yes,scrollbars=yes,height=undefined,width=
//un//defined', false);
// document.write("<html><head></head><body>");
// document.write("<center>");
// Name of Event
// Sanction Number.
// Date of Event
// Location (City,State)
// Meet Director
// Officals
document.writeln("Name of Event: ", document.getElementById("f1").value )
document.writeln("Sanction Number: ", document.getElementById("f2").value )
document.writeln("Date of Event: ", document.getElementById("f3").value )
document.writeln("Location (City,State): ", document.getElementById("f4").value )
document.writeln("Meet Director: ", document.getElementById("f5").value )
document.writeln("Officals: ", document.getElementById("f6").value )
// document.write("</table></body></html>");
//document.close();
}
</SCRIPT>
</head>
<BODY>
<p align="center">
<p align="center"><font face="Arial" size="2" color="#0989d2"><span dir="LTR"
style="font-size:13.5pt;font-family:Arial"><b>Weightlifting Competition Calculator</b> </span><i><span lang="HE"
style="font-size:10.0pt;font-family:Arial"><o:p> </o:p> </span></i><span
style="font-size:10.0pt;font-family:Arial"></span></font>
<form name=general>
<center>
<table border=1 bordercolor="#808080" cellspacing="0" >
<th colspan=300 bgcolor="ccccccc"><span class="style31"><font face="Verdana" size="2">Sanction
Information</font>
</span>
<tr><td bgcolor="ebebeb"><font face="Arial" size="2" color="0989d2"> Name of
Event </font></td><font face="Arial" size="2"><td><input id="f1" type="text"></td></tr>
<tr><td bgcolor="ebebeb"><font face="Arial" size="2" color="0989d2"> Sanction
Number. </font></td><font face="Arial" size="2"><td><input id="f2" type="text"></td></tr>
<tr><td bgcolor="ebebeb"><font face="Arial" size="2" color="0989d2"> Date of
Event </font></td><font face="Arial" size="2"><td><input id="f3" type="text"></td></tr>
<tr><td bgcolor="ebebeb"><font face="Arial" size="2" color="0989d2"> Location
(City,State) </font></td><font face="Arial" size="2"><td><input id="f4" type="text"></td></tr>
<tr><td bgcolor="ebebeb"><font face="Arial" size="2" color="0989d2"> Meet
Director </font></td><font face="Arial" size="2"><td><input id="f5" type="text"></td></tr>
<tr><td bgcolor="ebebeb"><font face="Arial" size="2" color="0989d2"> Officals </font></td><font
face="Arial" size="2"><td><input id="f6" type="text"></td></tr>
<tr>
<td colspan=16>
<input type="reset" value="Reset Input">
</td>
</tr>
</table>
</center>
</form>
<FORM name="myform">
<table>
<tr>
<th class="w42">Lot#</th>
<th class="w42">YOB</th>
<th class="w42">Div</th>
<th class="w42">Sex</th>
<th class="w55">Member #</th>
<th class="w123">Name</th>
<th class="w42">KG Class</th>
<th class="w123">Club</th>
<th class="w55">BWT</th>
<th class="w55">Snatch1</th>
<th class="w55">Snatch2</th>
<th class="w55">Snatch3</th>
<th class="w55">Best Snatch</th>
<th class="w42">C&J1 </th>
<th class="w42">C&J2 </th>
<th class="w42">C&J3 </th>
<th class="w42">Best C&J</th>
<th class="w42">Total</th>
<th class="w70">Sinclair</th>
<th class="w42">Place</th>
<th class="w42">Points</th>
</tr>
<tr>
<td><input id="in1" class="w42 inps" type="text"></td>
<td><input id="in2" class="w42 inps" type="text"></td>
<td><select id="in3">
<option value="0">SCH</option>
<option value="1">JR</option>
<option value="2">SR</option>
<option value="3">MST</option>
</SELECT>
</td>
<td><select id="in4">
<option value="0"></option>
<option value="1">M</option>
<option value="2">F</option>
</SELECT>
</td>
<td><input id="in4" class="w55 inps" type="text"></td>
<td><input id="in4" class="w123 inps" type="text"></td>
<td><input id="in5" class="w42 inps" type="text"></td>
<td><input id="in6" class="w123 inps" type="text"></td>
<td><input id="in7" class="w55 inps" type="text"></td>
<td><input id="in8" class="w55 inps" type="text"></td>
<td><input id="in9" class="w55 inps" type="text"></td>
<td><input id="in10" class="w55 inps" type="text"></td>
<td><input id="in11" class="w55 inps" type="text"></td>
<td><input id="in12" class="w42 inps" type="text"></td>
<td><input id="in13" class="w42 inps" type="text"></td>
<td><input id="in14" class="w42 inps" type="text"></td>
<td><input id="in15" class="w42 inps" type="text"></td>
<td><input id="in16" class="w42 inps" type="text"></td>
<td><input id="in17" class="w70 inps" type="text"></td>
<td><input id="in18" class="w42 inps" type="text"></td>
<td><input id="in18" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in19" class="w42 inps" type="text"></td>
<td><input id="in20" class="w42 inps" type="text"></td>
<td><select id="in3">
<option value="0">SCH</option>
<option value="1">JR</option>
<option value="2">SR</option>
<option value="3">MST</option>
</SELECT>
</td>
<td><select name="in21"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in4" class="w55 inps" type="text"></td>
<td><input id="in22" class="w123 inps" type="text"></td>
<td><input id="in23" class="w42 inps" type="text"></td>
<td><input id="in24" class="w123 inps" type="text"></td>
<td><input id="in25" class="w55 inps" type="text"></td>
<td><input id="in26" class="w55 inps" type="text"></td>
<td><input id="in27" class="w55 inps" type="text"></td>
<td><input id="in28" class="w55 inps" type="text"></td>
<td><input id="in29" class="w55 inps" type="text"></td>
<td><input id="in30" class="w42 inps" type="text"></td>
<td><input id="in31" class="w42 inps" type="text"></td>
<td><input id="in32" class="w42 inps" type="text"></td>
<td><input id="in33" class="w42 inps" type="text"></td>
<td><input id="in34" class="w42 inps" type="text"></td>
<td><input id="in35" class="w70 inps" type="text"></td>
<td><input id="in36" class="w42 inps" type="text"></td>
<td><input id="in36" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in37" class="w42 inps" type="text"></td>
<td><input id="in18" class="w42 inps" type="text"></td>
<td><select id="in3">
<option value="0">SCH</option>
<option value="1">JR</option>
<option value="2">SR</option>
<option value="3">MST</option>
</SELECT>
</td>
<td><select name="in39"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in4" class="w55 inps" type="text"></td>
<td><input id="in34" class="w123 inps" type="text"></td>
<td><input id="in35" class="w42 inps" type="text"></td>
<td><input id="in36" class="w123 inps" type="text"></td>
<td><input id="in37" class="w55 inps" type="text"></td>
<td><input id="in38" class="w55 inps" type="text"></td>
<td><input id="in39" class="w55 inps" type="text"></td>
<td><input id="in40" class="w55 inps" type="text"></td>
<td><input id="in41" class="w55 inps" type="text"></td>
<td><input id="in42" class="w42 inps" type="text"></td>
<td><input id="in43" class="w42 inps" type="text"></td>
<td><input id="in44" class="w42 inps" type="text"></td>
<td><input id="in45" class="w42 inps" type="text"></td>
<td><input id="in46" class="w42 inps" type="text"></td>
<td><input id="in47" class="w70 inps" type="text"></td>
<td><input id="in48" class="w42 inps" type="text"></td>
<td><input id="in36" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in49" class="w42 inps" type="text"></td>
<td><input id="in17" class="w42 inps" type="text"></td>
<td><select id="in3">
<option value="0">SCH</option>
<option value="1">JR</option>
<option value="2">SR</option>
<option value="3">MST</option>
</SELECT>
</td>
<td><select name="in3"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in4" class="w55 inps" type="text"></td>
<td><input id="in50" class="w123 inps" type="text"></td>
<td><input id="in51" class="w42 inps" type="text"></td>
<td><input id="in52" class="w123 inps" type="text"></td>
<td><input id="in53" class="w55 inps" type="text"></td>
<td><input id="in54" class="w55 inps" type="text"></td>
<td><input id="in55" class="w55 inps" type="text"></td>
<td><input id="in56" class="w55 inps" type="text"></td>
<td><input id="in57" class="w55 inps" type="text"></td>
<td><input id="in58" class="w42 inps" type="text"></td>
<td><input id="in59" class="w42 inps" type="text"></td>
<td><input id="in60" class="w42 inps" type="text"></td>
<td><input id="in61" class="w42 inps" type="text"></td>
<td><input id="in62" class="w42 inps" type="text"></td>
<td><input id="in63" class="w70 inps" type="text"></td>
<td><input id="in64" class="w42 inps" type="text"></td>
<td><input id="in36" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in65" class="w42 inps" type="text"></td>
<td><input id="in17" class="w42 inps" type="text"></td>
<td><select id="in3">
<option value="0">SCH</option>
<option value="1">JR</option>
<option value="2">SR</option>
<option value="3">MST</option>
</SELECT>
</td>
<td><select name="in3"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in4" class="w55 inps" type="text"></td>
<td><input id="in66" class="w123 inps" type="text"></td>
<td><input id="in67" class="w42 inps" type="text"></td>
<td><input id="in68" class="w123 inps" type="text"></td>
<td><input id="in69" class="w55 inps" type="text"></td>
<td><input id="in70" class="w55 inps" type="text"></td>
<td><input id="in71" class="w55 inps" type="text"></td>
<td><input id="in72" class="w55 inps" type="text"></td>
<td><input id="in73" class="w55 inps" type="text"></td>
<td><input id="in74" class="w42 inps" type="text"></td>
<td><input id="in75" class="w42 inps" type="text"></td>
<td><input id="in76" class="w42 inps" type="text"></td>
<td><input id="in77" class="w42 inps" type="text"></td>
<td><input id="in78" class="w42 inps" type="text"></td>
<td><input id="in79" class="w70 inps" type="text"></td>
<td><input id="in80" class="w42 inps" type="text"></td>
<td><input id="in36" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in81" class="w42 inps" type="text"></td>
<td><input id="in17" class="w42 inps" type="text"></td>
<td><select id="in3">
<option value="0">SCH</option>
<option value="1">JR</option>
<option value="2">SR</option>
<option value="3">MST</option>
</SELECT>
</td>
<td><select name="in3"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in4" class="w55 inps" type="text"></td>
<td><input id="in82" class="w123 inps" type="text"></td>
<td><input id="in83" class="w42 inps" type="text"></td>
<td><input id="in84" class="w123 inps" type="text"></td>
<td><input id="in85" class="w55 inps" type="text"></td>
<td><input id="in86" class="w55 inps" type="text"></td>
<td><input id="in87" class="w55 inps" type="text"></td>
<td><input id="in88" class="w55 inps" type="text"></td>
<td><input id="in89" class="w55 inps" type="text"></td>
<td><input id="in90" class="w42 inps" type="text"></td>
<td><input id="in91" class="w42 inps" type="text"></td>
<td><input id="in92" class="w42 inps" type="text"></td>
<td><input id="in93" class="w42 inps" type="text"></td>
<td><input id="in94" class="w42 inps" type="text"></td>
<td><input id="in95" class="w70 inps" type="text"></td>
<td><input id="in96" class="w42 inps" type="text"></td>
<td><input id="in36" class="w42 inps" type="text"></td>
</tr>
<tr>
<td colspan=16>
<input type="button" onClick="calculation()" value="Calculate Total">
<input type="reset" value="Reset All Data">
<input type="button" onclick="print()" value="Print"
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
-
April 12th, 2007, 01:28 PM
#2
Re: how to display results in another html window
 Originally Posted by liftthis
I am trying to display information from my text boxes to another html window (pop up). using the print button.
You can't hook the print button in any browser. Now, if you are talking about a custom <input> tag which you have "Print" as its value, then just output your results to the open window.
Code:
<script type="text/javascript">
winParameters = 'top=0,left=0,width=320,height=240';
var newWindow = document.open('', '', winParameters);
newWindow.focus();
// now write your ouput
newWindow.document.write('Hello!');
</script>
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
April 12th, 2007, 02:56 PM
#3
Re: how to display results in another html window
I am confused. with your answer. I come from the C and C++ work were I can print out my variables to a file.
I thought I could put some code in the print function to display what was inputed in the form in another window.
-
April 12th, 2007, 03:57 PM
#4
Re: how to display results in another html window
The code I posted shows you how to open another window and print something to that newly opened window.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|