Go Back   CodingForums.com > :: Client side development > JavaScript programming > Dynamic Drive scripts help

Before you post, read our: Rules & Posting Guidelines

 
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-26-2004, 02:13 PM   PM User | #1
Emily1511
New Coder

 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Emily1511 is an unknown quantity at this point
document.location is driving me mad.

Basically i'm trying to get the small scrollable window to change its content on the day of the week.
At the moment it changes the whole page to the day.html.
So how do i get the day.html to target the Iframe it is in??


Code:
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>GTF</title>
</head>

<body bgcolor="#FFFFFF">

<p align="center">GTF</p>

<script type="text/javascript">

iens6=document.all||document.getElementById
ns4=document.layers

//specify speed of scroll (greater=faster)
var speed=5

if (iens6){
document.write('<div id="container" style="position:relative;width:175px;height:160px;border:1px solid black;overflow:hidden">')
document.write('<div id="content" style="position:absolute;width:170px;left:0;top:0">')
}
</script>

<ilayer name="nscontainer" width=175 height=160 clip="0,0,175,160">
<layer name="nscontent" width=175 height=160 visibility=hidden>

<!--INSERT CONTENT HERE-->
<script>
<!--
mydate=new Date()
today=mydate.getDay()
if (today==1)
document.location="monday.html";
else if (today==2)
document.location="tuesday.html";
else if (today==3)
document.location="wednesday.html";
else if (today==4)
document.location="thursday.html";
else if (today==5)
document.location="friday.html";
else if (today==6)
document.location="saturday.html";
else
document.location="sunday.html";
//-->
</script>
<!--END CONTENT-->

</layer>
</ilayer>

<script language="JavaScript1.2">
if (iens6)
document.write('</div></div>')
</script>

<table width="175px"><td><p align="right">
<a href="#" onMouseover="moveup()" onMouseout="clearTimeout(moveupvar)"><img src="up.gif" border=0></a>  <a href="#" onMouseover="movedown()" onMouseout="clearTimeout(movedownvar)"><img src="down.gif" border=0></a></p></td>
</table>

<script language="JavaScript1.2">
if (iens6){
var crossobj=document.getElementById? document.getElementById("content") : document.all.content
var contentheight=crossobj.offsetHeight
}
else if (ns4){
var crossobj=document.nscontainer.document.nscontent
var contentheight=crossobj.clip.height
}

function movedown(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"
else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",20)
}

function moveup(){
if (iens6&&parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+speed+"px"
else if (ns4&&crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout("moveup()",20)

}

function getcontent_height(){
if (iens6)
contentheight=crossobj.offsetHeight
else if (ns4)
document.nscontainer.document.nscontent.visibility="show"
}
window.onload=getcontent_height
</script>
</body>
</html>

Thanx
Emily
xxx

Last edited by Emily1511; 05-27-2004 at 02:21 PM.. Reason: typing error
Emily1511 is offline  
Old 05-28-2004, 09:49 PM   PM User | #2
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
Try: document.frames['IFRAME'].location="monday.html";
Willy Duitt is offline  
Old 06-01-2004, 08:58 AM   PM User | #3
Emily1511
New Coder

 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Emily1511 is an unknown quantity at this point
No joy!

Does not seem to work.
I'm trying to use it in an ILAYER, not an IFRAME.
I tried coding
Code:
document.frames['nscontent'].location="monday.html";
but it doesn't work.

So is it possible to target an ILAYER in that way?
Also which of the ILAYERS is the correct target?

Code:
<ilayer name="nscontainer" width=175 height=160 clip="0,0,175,160">
<layer name="nscontent" width=175 height=160 visibility=hidden>

<!--INSERT CONTENT HERE-->
<script>
<!--
mydate=new Date()
today=mydate.getDay()
if (today==1)
document.location="monday.html";
else if (today==2)
document.location="tuesday.html";
else if (today==3)
document.location="wednesday.html";
else if (today==4)
document.location="thursday.html";
else if (today==5)
document.location="friday.html";
else if (today==6)
document.location="saturday.html";
else
document.location="sunday.html";
//-->
</script>
<!--END CONTENT-->
Ta
Emily
Emily1511 is offline  
 

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:04 AM.


Advertisement
Log in to turn off these ads.