Click to See Complete Forum and Search --> : What does this javascript instruct?


opihi
12-02-2002, 07:07 PM
Hello.

I am using a wysiwyg editor to teach myself how html works. In studying the code behind a page with frames I created with the editor, I found this javascript. I tried to find out from the editor's live technical help what the javascript was for, but they said they couldn't tell me. I haven't been able to find the answer in javascript books.

Could one of you forum members please tell me what this script instructs:

var n4p = (self.innerHeight != null && self.innerHeight == 0);
if ((parent.TlxPgNm==null || parent.TlxPgNm!='index') && !n4p){
location.replace('index.htm');
}

Thank you very much.

Jane

Ryan
12-02-2002, 07:17 PM
i think it might help us if you include the whole page source. but as far as i can tell, it redirects the browser to index.htm if parent.TlxPgNm is null, or if parent.TlxPgNm is not equal to index.

opihi
12-02-2002, 08:58 PM
Ryan,

Thank you for your reply.
Here are the sources for the two frames that make up the page:

The navigation frame source:

<HTML>
<HEAD>
<TITLE>New Mexico Sound Recordist - Jim Gallup </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<SCRIPT language="JavaScript">
var n4p = (self.innerHeight != null && self.innerHeight == 0);
if ((parent.TlxPgNm==null || parent.TlxPgNm!='index') && !n4p){
location.replace('index.htm');
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#F7F7FF" LINK="#999980" ALINK="#CC7661" VLINK="#999980">
<bR>
<div style="text-align:CENTER; "><FONT SIZE="3" COLOR="#999980" FACE="Goudy Old Style"><B>Home</B></FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="4" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div style="text-align:CENTER; "><FONT SIZE="3" COLOR="#999980" FACE="Goudy Old Style"><A HREF="credits.htm" TARGET="_top" TITLE="Credits"><U>Credits</U></A></FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="4" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div style="text-align:CENTER; "><FONT SIZE="3" COLOR="#999980" FACE="Goudy Old Style"><A HREF="photos.htm" TARGET="_top" TITLE="Photos"><U>Photos</U></A></FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="4" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div style="text-align:CENTER; "><FONT SIZE="3" COLOR="#999980" FACE="Goudy Old Style"><A HREF="contact.htm" TARGET="_top" TITLE="Contact"><U>Contact</U></A></FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="4" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div style="text-align:CENTER; "><FONT SIZE="3" COLOR="#999980" FACE="Goudy Old Style"><A HREF="mailto:nmsoundman@aol.com" TARGET="_top" TITLE="mailto:nmsoundman@aol.com"><U>e-mail</U></A></FONT></div>
</BODY>
</HTML>

The main page source:

<HTML>
<HEAD>
<TITLE>New Mexico Sound Recordist - Jim Gallup </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<SCRIPT language="JavaScript">
var n4p = (self.innerHeight != null && self.innerHeight == 0);
if ((parent.TlxPgNm==null || parent.TlxPgNm!='index') && !n4p){
location.replace('index.htm');
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#F7F7FF" LINK="#CC9966" ALINK="#E6764D" VLINK="#CC9966">
<bR>
<div><FONT SIZE="7" COLOR="#CC9966" FACE="Goudy Old Style"><B>Jim Gallup</B></FONT></div>
<div><FONT SIZE="7" COLOR="#CC9966" FACE="Goudy Old Style"><B>New Mexico Sound Recordist</B></FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="11" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="6" COLOR="#FFFFCC" FACE="Times New Roman">Excellent Production Sound for Film and Video</FONT></div>
<div><FONT SIZE="5" COLOR="#999980" FACE="Goudy Old Style">Among the Finest Over-the-Shoulder Sound Recordists</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="38" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#999980" FACE="Goudy Old Style"><B><IMG SRC="0052cf80.jpg" border=0 width="300" height="248" ALIGN="BOTTOM" HSPACE="0" VSPACE="0"></B></FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="12" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="2" COLOR="#FFFFCC" FACE="Times New Roman">Working on Learning Channel's &quot;Making It&quot;. I'm at the</FONT></div>
<div><FONT SIZE="2" COLOR="#FFFFCC" FACE="Times New Roman">Caterpillar D-10 Manufacturing Plant in Lafayette,</FONT></div>
<div><FONT SIZE="2" COLOR="#FFFFCC" FACE="Times New Roman">Indiana.</FONT></div>
<bR>
<bR>
<bR>
<div>
<div ALIGN="LEFT">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="492" BORDERCOLORLIGHT="#C0C0C0" BORDERCOLORDARK="#808080" FRAME="BOX" RULES="ALL" HSPACE="0" VSPACE="0"
>
<tR>
<tD VALIGN=TOP HEIGHT= "758" WIDTH="492"><div><FONT SIZE="5" COLOR="#CC9966" FACE="Times New Roman">I started out in 1986 as a free-lance network news soundman. Since then I've worked on film and video productions of all kinds -- television shows, educational films, and commercials. Now most of my work is in production sound for film and video documentaries.</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="27" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Times New Roman">I've worked in all formats from 35mm and 16mm through HDTV, Betacam, and Mini DV, and I have all the gear needed for any production.</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="30" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Times New Roman">My custom sound packages are built around a Cooper CS104 - 4 channel mixer, a Fostex PD4 timecode DAT (with a Smart Slate), and a Sound Devices Mix Pre - 2 channel mixer.</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="30" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Times New Roman">I use Schoeps and Sennheiser boom microphones, Lectrosonics UHF frequency - agile, diversity wireless systems (with Sanken and Sonotrim lavaliers), and I have Lectrosonics wireless personal monitors.</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="30" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Times New Roman">High quality audio cassette transcripts are available as well as a variety of other versatile production sound tools.</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="30" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Times New Roman">The Southwest is my bailiwick but I can go anywhere.</FONT></div>
</tD>
</tR>
</TABLE>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="1" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="4" COLOR="#CC9966" FACE="Times New Roman"><IMG SRC="0062c290.jpg" border=0 width="300" height="297" ALIGN="BOTTOM" HSPACE="0" VSPACE="0"></FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="18" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="2" COLOR="#FFFFCC" FACE="Times New Roman">In Trittenheim, Germany for Food Network's</FONT></div>
<div><FONT SIZE="2" COLOR="#FFFFCC" FACE="Times New Roman">&quot;Extreme Cuisine&quot; shoot</FONT></div>
<bR>
<bR>
<bR>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">Jim Gallup</FONT></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">p.o. box 624</FONT></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">Tijeras, NM &nbsp;87059</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="20" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">home: (505) 286 - 8943</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="4" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">fax: (505) 286 - 8943</FONT></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">pager: (505) 875 - 4474</FONT></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">mobile: (505) 321 - 9162</FONT></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">e-mail: <A HREF="mailto: nmsoundman@aol.com" TARGET="_top" TITLE="mailto: nmsoundman@aol.com"><U>nmsoundman@aol.com</U></A></FONT></div>
<div><FONT SIZE="5" COLOR="#CC9966" FACE="Goudy Old Style">www.newmexicosoundrecordist.com</FONT></div>
<div><IMG BORDER="0" SRC="1x1.gif" HEIGHT="22" ALIGN="bottom" WIDTH="1" HSPACE="0" VSPACE="0"
></div>
<bR>
<bR>
<div><FONT SIZE="3" COLOR="#CC9966" FACE="Times New Roman"><A HREF="index_m.htm" TITLE="New Mexico Sound Recordist Jim Gallup"><U>top of page</U></A></FONT></div>
<bR>
<bR>
<bR>
</BODY>
</HTML>

Can you make sense of the javascript from these examples?

Ryan
12-02-2002, 09:51 PM
i still kind of think that the javascript you're using tests to see if your page is contained in frames, and if not, redirects the user to the page with frames.

opihi
12-03-2002, 08:42 PM
Thanks, Ryan.

Ryan
12-03-2002, 11:51 PM
you're welcome.