...

View Full Version : Displaying different items for different pages in a frame using an if statement?



pthompson2002
08-06-2002, 09:54 AM
I am having problems getting an if statement to work. I have a page split into three frames: a menu frame (known as toc.htm), a header frame (menu.htm) and a main_window (known as fcont_login.htm). I don't want the page to display a count down clock when the main window (knwon as maintask) is fcont_login.htm. When it is any other page I want it to display the timer. I thought this would be a simple if (below) but I can't get it to work, it doesn't display the counter on any page and says there are JavaScript errors! Help is needed!!

cheers Pete

--the code--
<script language="javascript">
if (!(parent.maintask.location == fcont_login.htm))
{
document.write('<td valign=bottom width=16%>&nbsp;&nbsp;<font size=2><b>Auto Logoff in:</b></font></td>');
if (document.layers)
{
document.write('<td valign=bottom width=12%><ilayer id="ns4timer"><layer id="ns4timer2" width=100%>&nbsp;&nbsp;</layer></ilayer></td>');
}
if (document.all)
{
document.write('<td valign=bottom><div id="timer">&nbsp;&nbsp;</div></td>');
}
if (document.getElementById && document.createRange)
{
document.write('<td valign=bottom><div id="N6timer">&nbsp;&nbsp;</div></td>');
}
} else
{
if (parent.maintask.location.href == fcont_login.htm)
{
document.write('<td></td>');
}
}
</script>

glenngv
08-06-2002, 11:15 AM
<script language="javascript">
if (top.frames["maintask"].location.href.indexOf("fcont_login.htm")==-1)
{
document.write('<td valign=bottom width=16%> <font size=2><b>Auto Logoff in:</b></font></td>');
if (document.layers)
{
document.write('<td valign=bottom width=12%><ilayer id="ns4timer"><layer id="ns4timer2" width=100%> </layer></ilayer></td>');
}
else if (document.all)
{
document.write('<td valign=bottom><div id="timer"> </div></td>');
}
else if (document.getElementById && document.createRange)
{
document.write('<td valign=bottom><div id="N6timer"> </div></td>');
}

}
else //maintask location is fcont_login.htm
{
document.write('<td></td>');

}
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum