Printer friendly page (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


mjmtravel -> Printer friendly page (4/8/2007 10:43:13)

Can anyone tell me what is wrong with my script on this page. I'm trying to set up a printer friendly page with these instructions.
http://personalweb.about.com/od/copypastejavascripts/a/404_3scripts_3.htm

Here is my code, I just get a page error when trying to print the page.

<HTML>
<HEAD>
<TITLE>Condo Listing Sample - Palm Island Condos</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<meta name="description" content="See how good your condo listing could look.">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HE>\n<BODY>\n';

var printReadyElem = document.getElementById("printReady");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n</BO>\n</HT>';

var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser.
Please update your browswer.");
}
}
</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 style="margin:0px;padding:0px ">
<!-- ImageReady Slices (Home.psd - Slices: 01, 02) -->
<TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0 background="images/bg4_01.jpg" >
	<TR>
		<TD valign="top" align="center" WIDTH=100% height="100%">
<TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD valign="top" align="center">
			<TABLE WIDTH=730 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<TABLE WIDTH=346 BORDER=0 CELLPADDING=0 height="568" style="background-position:   left center; background-repeat:repeat; background-attachment:fixed; background-image:url('images/beige111.jpg'); border-collapse:collapse">
	<TR>
		<TD style="vertical-align: top; background-repeat: no-repeat; background-position:   left top; ; padding-left:5px; padding-right:0px" width="346" height="568" nowrap>
<div style="padding-left: 10px; padding-right: 10px; padding-top: 5px; width: 360px; height: 568px; overflow: auto; ">
	 <table border="1" style="border-collapse: collapse" width="70%" height="20px" id="table2">
		<tr>
			<td>
	<h2><b><font face="Firenze SF" color="#494949">St. Croix, US Virgin Islands</font></b></h2>
			</td>
		</tr>
	</table>
	<div id="printReady"> 
<font color="#494949"><b>
<p>Example Listing Page</b><br>
Our 2 bedroom 2 baths, condominium located in the town 
of Christiansted with a beautiful view of Christiansted Harbor and the Caribbean 
Sea. Just remodeled with new furniture and appliances. A/C in both bedrooms for 
a great night sleep. Facing east you will enjoy the fantastic breeze blowing 
through the condo all of the time. </font></p>
</p>
<p><font color="#494949">A large pool located just below with a bathroom, BBQ 
grill, lounge chairs and a covered dining table. 2 minutes from downtown 
shopping and restaurants galore. 5 minutes from one of the best beaches on the 
island. A perfect location for a perfect vacation.</font></p>
<h3><font color="#494949" face="Firenze SF">Features</font></h3>
<ul>
	<li><font color="#494949">Sleeps 4</font></li>
	<li><font color="#494949">Master Bedroom - Queen size bed</font></li>
	<li><font color="#494949">2nd Bedroom - Queen size bed</font></li>
	<li><font color="#494949">Full Kitchen, Dining, Living Room</font></li>
	<li><font color="#494949">Large outdoor gallery with ocean view</font></li>
</ul>
<h3><font face="Firenze SF" color="#656156">Amenities</font></h3>
	<table border="0" width="315" height="179" bordercolor="#7FFDFF" id="table1" style="border-collapse: collapse">
		<tr>
			<td height="28" width="105"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R3"></font><font size="2" color="#494949">Refrigerator</font></font></td>
			<td height="28" width="105"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R4"></font><font size="2" color="#494949">Range</font></font></td>
			<td height="28" width="105"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R5"></font><font size="2" color="#494949">Dishwasher</font></font></td>
		</tr>
		<tr>
			<td width="105" height="28"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R2"></font><font size="2" color="#494949">Garbage 
			Disp</font></font></td>
			<td width="105" height="28"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R6"></font><font size="2" color="#494949">Microwave</font></font></td>
			<td height="28" width="105"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R7"></font><font size="2" color="#494949">Cable 
			TV</font></font></td>
		</tr>
		<tr>
			<td width="105" height="28"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R8"></font><font size="2" color="#494949">A/C</font></font></td>
			<td width="105" height="28"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R9"></font><font size="2" color="#494949">Ceiling 
			Fans</font></font></td>
			<td width="105" height="28"><font face="Tahoma">
			<font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R10"></font><font size="2" color="#494949">Coffee 
			Maker</font></font></td>
		</tr>
		<tr>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R11"><font size="2">Washer/Dryer</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R12"><font size="2">Kitchen ware</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R13"><font size="2">Linens</font></font></td>
		</tr>
		<tr>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R14"><font size="2">Blender</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R15"><font size="2">CD 
			Player</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R16"><font size="2">DVD 
			Player</font></font></td>
		</tr>
		<tr>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R17"><font size="2">Hair 
			Dryer</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R18"><font size="2">Iron 
			& Board</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R19"><font size="2">Beach 
			Towels</font></font></td>
		</tr>
		<tr>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R20"><font size="2">Ice 
			Maker</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R21"><font size="2">Internet</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R22"><font size="2">Beach 
			Chairs</font></font></td>
		</tr>
		<tr>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R23"><font size="2">Au-natural<br>
    Sunbathing</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R24"><font size="2">Golf 
			Nearby</font></font></td>
			<td width="105" height="28"><font face="Tahoma" color="#494949">
			<input type="radio" value="V1" checked name="R25"><font size="2">Private 
			Pool</font></font></td>
		</tr>
	</table>
	<p><b><font face="Firenze SF" color="#494949" size="4">Rates</font></b></p>
	<table border="1" width="88%" height="117" id="table3">
		<tr>
			<td width="162" align="center" height="30"><b>
			<font color="#494949" face="Firenze SF">Season</font></b></td>
			<td align="center" height="30"><b>
			<font color="#494949" face="Firenze SF">Rates</font></b></td>
		</tr>
		<tr>
			<td width="162" height="25">
			<font face="Tahoma" color="#494949" size="2">December-March</font></td>
			<td height="25"><font face="Tahoma" color="#494949" size="2">
			$1800.00 per week    </font></td>
		</tr>
		<tr>
			<td width="162" height="25">
			<font face="Tahoma" size="2" color="#494949">April-August</font></td>
			<td height="25"><font face="Tahoma" size="2" color="#494949">
			$1400.00 per week</font></td>
		</tr>
		<tr>
			<td width="162" height="25">
			<font face="Tahoma" size="2" color="#494949">September-November</font></td>
			<td height="25"><font face="Tahoma" size="2" color="#494949">
			$1200.00 per week</font></td>
		</tr>
		</div>
	</table>
	<p><a href="javascript:void(printSpecial())">Print Condo Details</a></p>




BeTheBall -> RE: Printer friendly page (4/8/2007 12:06:38)

Two things. The error is due to these lines:

alert("The print ready feature is only available if you are using an browser.
Please update your browswer.");


That needs to be all on one line. Moreover, the text really doesn't make any sense. Should probably look like this:

alert("The print ready feature is only available if you are using a javascript-enabled browser. Please update your browser.");


Second, and probably not causing the error, is the placement of your closing </div> tag. It should be below, not above the closing </table> tag.




mjmtravel -> RE: Printer friendly page (4/8/2007 12:20:02)

Duane
Thanks again, I can't believe how fast you can find that kind of stuff. I tried it and its works perfectly.
Thanks again.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
9.570313E-02