Click to See Complete Forum and Search --> : Can you find the error?


tf8252
12-21-2002, 12:23 PM
Can someone please tell me why I'm getting an error message from this code when I click the link image? The


<TABLE border=0 cellPadding=0 cellSpacing=0 width="90%" align="center">
<TR>
<TD align=left><IMG border=0 height=278 src="images/home.jpg" width=414></TD>
<TD align=right> <a href="javascript:openWin('refund.html');"> <img border=0 height=134 src="images/riskfree.gif" width=133></a></TD>
</TR>
<TR>
</tr>
<TR>
</tr>
</TABLE>

The page is located here: www.ehomeparade.com

Thanks!

pyro
12-21-2002, 12:56 PM
Try this instead.

<TABLE border=0 cellPadding=0 cellSpacing=0 width="90%" align="center">
<TR>
<TD align=left><IMG border=0 height=278 src="images/home.jpg" width=414></TD>
<TD align=right> <a href="javascript:window.open('refund.html');"> <img border=0 height=134 src="images/riskfree.gif" width=133></a></TD>
</TR>
<TR>
</tr>
<TR>
</tr>
</TABLE>

Charles
12-21-2002, 01:03 PM
You're getting that error because you neglected to define openWin(). And you're needlessly trying to make a page that doesn't work for 12% of users. Try instead:

<td align="right"><a href="refund.html" onclick="window.open(this.href); return false"><img border="0" height="134" src="images/riskfree.gif" width="133" alt="refund" /></a></td>

And be warned, in the United States the Americans with Disabilities Act applies to the internet (http://www.usdoj.gov/crt/foia/tal712.txt). As such, I would suggest that you follow the US Department of Justice Web Accessibility Guidelines (http://www.access-board.gov/sec508/guide/1194.22.htm) or the Web Content Accessibility Guidelines 1.0 from the W3C (http://www.w3.org/TR/WCAG10/). And there's a good introduction to web accessibility at http://diveintoaccessibility.org/.

pyro
12-21-2002, 01:05 PM
Ok, after a bit more testing, I don't that the above does what it is supposed to. This should do what you want.
This goes in your <head>

<Script language=JavaScript>
function openwin()
{
var page = "refund.html";
var windowproperties = " width=550,height=300,location=yes,toolbar=yes,menu


bar=yes,scrollbars=yes,resizable=yes";
var name = "internalWin";

window.open(page, name, windowproperties);
}
</Script>


This goes in your body

<TABLE border=0 cellPadding=0 cellSpacing=0 width="90%" align="center">
<TR>
<TD align=left><IMG border=0 height=278 src="images/home.jpg" width=414></TD>
<TD align=right> <a href="javascript:openwin();"> <img border=0 height=134 src="images/riskfree.gif" width=133></a></TD>
</TR>
<TR>
</tr>
<TR>
</tr>
</TABLE>

Charles
12-21-2002, 01:07 PM
Originally posted by pyro
Try this instead.
<TABLE border=0 cellPadding=0 cellSpacing=0 width="90%" align="center">
<TR>
<TD align=left><IMG border=0 height=278 src="images/home.jpg" width=414></TD>
<TD align=right> <a href="javascript:window.open('refund.html');"> <img border=0 height=134 src="images/riskfree.gif" width=133></a></TD>
</TR>
<TR>
</tr>
<TR>
</tr>
</TABLE>
1) That will not work they way you expect in Microsoft 6, Netscape 6, or Opera 6.

2) That will make the page inaccessible to the 12% of users who do not use JavaScript. And note that the page is for a commercial enterprise in the United States. Federal Law requires that the page be accessible.

Charles
12-21-2002, 01:10 PM
Originally posted by pyro
Ok, after a bit more testing, I don't that the above does what it is supposed to. This should do what you want.
This goes in your <head>

<Script language=JavaScript>
function openwin()
{
var page = "refund.html";
var windowproperties = " width=550,height=300,location=yes,toolbar=yes,menu


bar=yes,scrollbars=yes,resizable=yes";
var name = "internalWin";

window.open(page, name, windowproperties);
}
</Script>


This goes in your body
<TABLE border=0 cellPadding=0 cellSpacing=0 width="90%" align="center">
<TR>
<TD align=left><IMG border=0 height=278 src="images/home.jpg" width=414></TD>
<TD align=right> <a href="javascript:openwin();"> <img border=0 height=134 src="images/riskfree.gif" width=133></a></TD>
</TR>
<TR>
</tr>
<TR>
</tr>
</TABLE>

But the LANGUAGE attribute to the SCRIPT element has been depricated in XHTML and if you look at the page you will note that the inquirer is using XHTML.

tf8252
12-21-2002, 01:24 PM
I used Charles' code, and it works...almost.

The new window opens completely minimized now.

www.ehomeparade.com

pyro
12-21-2002, 01:26 PM
Oops. Didn't notice that. Yeah, just use Charles meathod then...

Charles
12-21-2002, 01:29 PM
Originally posted by tf8252
I used Charles' code, and it works...almost.

The new window opens completely minimized now.

www.ehomeparade.com See http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1202731 for the details concerning the geometry of that new window.