Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
Naughtytrini #1
Moving the Div Region
Hello! I'm working on a site where I have some content in a div tag. I want
this Div region to load when the page loads then move down the screen slowly.
It then stops then after about 20 seconds it then moves back to the top of the
screen then either fades out or disappear. This is the code that I have so far:
<script language="JavaScript">
objectLeftPos = 170;
objectTopPos = 0;
function moveDown() {
if (document.all) {object = box.style}
if (document.layers) {object = document.box}
if (objectTopPos < 300) {
objectTopPos += 1;
object.top = objectTopPos;
setTimeout("moveDown()",20)
}
}
function moveUp() {
if (document.all){object = box.style}
if (document.layers) {object = document.box}
if (objectTopPos = 300) {
objectTopPos -= 1;
object.top = objectTopPos;
setTimeout("moveUp()",20)
}
}
</script>
Box is the id of the Div region. And on the body tag I have the following
event : <body onload="moveDown(); moveUp()">
The problem is that the div doesn't go back up as it is now. If I take out the
moveUp() function from the body tag then it moves down slowly and stop where it
is suppose to. Like I said I need for it to go down, stop, then move back up
and disappear. Can anyone help me solve this problem.
Thanks!
Naughtytrini Guest
-
I know we can set max image width, but I need to set itby region. Region A has one max width; Region B another.
We can already set a maximum image width for use globally, throughout every page. Can we do it by region? This way one region can have a max... -
Edit region
I made a page in Dreamweaver with an edit region. But no matter which role I connect with I can still edit other parts of the page too. What am I... -
Sort Region
I hope this is the correct forum for this. If not, I'd like to ask a moderator to direct me to the correct forum. Has anyone tried this... -
Moving Randomly Moving Sprite To New Location on mouseEnter
Hi All, This is way over my head. I am currently using Director 8. I have a randomly moving sprite(call it X) on stage (I accomplished this... -
Repeating Region
Hello all, I have a repeating region for a navigation bar. (Link | Link | Link) The repeating region looks like this: <REPEAT BEGIN><EDITABLE... -
T.Pastrana - 4Level #2
Re: Moving the Div Region
Not optimized but something like this should get you going at least...
<script language="JavaScript">
objectLeftPos = 170;
objectTopPos = 0;
function moveDown() {
var
object=document.getElementById?document.getElement ById("box").style:document
..box;
if (objectTopPos < 300) {
objectTopPos += 1;
object.top = objectTopPos;
setTimeout("moveDown()",20)
}else{moveUp()}
}
function moveUp() {
var
object=document.getElementById?document.getElement ById("box").style:document
..box;
if (objectTopPos >= 0) {
objectTopPos -= 1;
object.top = objectTopPos;
setTimeout("moveUp()",20);
}
if(objectTopPos==0){
object.visibility="hidden";}
}
</script>
<body onload="moveDown()" etc...>
Look for a wrap on the var object=document. line. You may have to unwrap
this one. By the way, using getElementById will allow it to work in more
browsers.
--
Regards,
...Trent Pastrana
[url]www.fourlevel.com[/url]
-----------------------------
"Naughtytrini" <webforumsuser@macromedia.com> wrote in message
news:cggn5s$aj0$1@forums.macromedia.com...want> Hello! I'm working on a site where I have some content in a div tag. Islowly.> this Div region to load when the page loads then move down the screenthe> It then stops then after about 20 seconds it then moves back to the top offar:> screen then either fades out or disappear. This is the code that I have soout the>
> <script language="JavaScript">
>
> objectLeftPos = 170;
> objectTopPos = 0;
>
> function moveDown() {
> if (document.all) {object = box.style}
> if (document.layers) {object = document.box}
> if (objectTopPos < 300) {
> objectTopPos += 1;
> object.top = objectTopPos;
> setTimeout("moveDown()",20)
> }
> }
>
> function moveUp() {
> if (document.all){object = box.style}
> if (document.layers) {object = document.box}
> if (objectTopPos = 300) {
> objectTopPos -= 1;
> object.top = objectTopPos;
> setTimeout("moveUp()",20)
> }
> }
>
> </script>
>
> Box is the id of the Div region. And on the body tag I have the following
> event : <body onload="moveDown(); moveUp()">
>
> The problem is that the div doesn't go back up as it is now. If I takewhere it> moveUp() function from the body tag then it moves down slowly and stopup> is suppose to. Like I said I need for it to go down, stop, then move back> and disappear. Can anyone help me solve this problem.
>
> Thanks!
>
T.Pastrana - 4Level Guest



Reply With Quote

