Solved

animation in html

Posted on 2000-03-09
4
197 Views
Last Modified: 2013-11-19
i need a script that enter image to my html doc from top and going out   in a loop
thanks
0
Comment
Question by:rutie37
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Expert Comment

by:xabi
ID: 2603590
You will find all what you need here:
http://www.dansteinman.com/dynduo/en/path.html
and here:
http://www.dansteinman.com/dynduo/duopath/index.html

But I recomend you to use Dreamweaver to create a path for an image to move around a page.

xabi
0
 
LVL 4

Expert Comment

by:FRehman
ID: 2611110
you can insert image tag for image
<input type="image" src="test.gif">
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2615438
You will need at least one layer, and javascript code. Dansteinmann is very famous on this kind of stuff.

For IE you have a layer <DIV>, this has a style attribute with the position of the layer. like

<DIV name='moveit' style="position:absolute; left:10; top:100;">
   ...
</DIV>

etc.

Anyway. In the javascript code you use the name of the layer, and the style..get the psotion and change it to your likings. To let it keep moving you set a time like.
setTimeOut("function-name()", 100)
(the 100 is the time in milli-seconds it will wait to re-do the function)

so, eventually it will look like:

<script language=javascript>
<!--
   function MoveItAway()
   {
      var x-now, y-now, x-new, y-new;
      x-now = moveit.style.left;
      y-now = moveit.style.top;
      x-new = (some math-function-stuff)
      y-new = (some math-function-stuff)
      moveit.style.left = x-new;
      moveit.style.top = y-new;
      tTimer = setTimeOut("MoveItAway()", 100)
   }
//-->
</script>

Of course you should put in it whatever you need!
   }
0
 
LVL 2

Accepted Solution

by:
Bhargava earned 50 total points
ID: 2661887
check if this works.
similar to the one posted by CJ_S

<HTML>
<HEAD>
<TITLE></TITLE>
<style>
#img{position:absolute;
visibility:visible;
top:0px;}
</style>
<script language=javascript>
var isIE=false,isNav=false;
if(parseInt(navigator.appVersion) >= 4){
      if(navigator.appName == "Netscape")      {
            isNav=true;
            isIE=false;
      }else{
            isNav=false;
            isIE=true;
      }
}
function set(){
      if(isNav){      
            result = document.img.top + 15 + document.img.clip.height;
            if(result < screen.height){
                  document.img.top += 15;      
                  document.img.left += 25;
            }else{
                  document.img.top = 0;
                  document.img.left = 0;
            }
      }else if(isIE){      
            if(img.style.top){
                  result = parseInt(img.style.top) + 15 + parseInt(img.offsetHeight);
                  if(result < screen.height){
                        img.style.top = parseInt(img.style.top) + 15;      
                        img.style.left = parseInt(img.style.left) + 25;
                  }else{
                        img.style.top = 0;
                        img.style.left = 0;
                  }
            }else{
                  img.style.top = 0;
            }
      }      
      
      
      window.setTimeout('set();',1000);
}
</script>
</HEAD>
<BODY onload="window.setTimeout('set();',1000)">
<div id=img name=img>
<P><IMG align=middle alt=Bear src="images/Bear.gif"></P>
</div>
</BODY>
</HTML>


0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question