Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:29:43+00:00 2026-06-12T09:29:43+00:00

<HTML><head> <Script language=JavaScript> <!– function changePos() { width = document.body.clientWidth; //the width of the

  • 0
<HTML><head>
<Script language="JavaScript">
<!--
function changePos() 
{
 width = document.body.clientWidth;   //the width of the current document
 height = document.body.clientHeight; //the height of the current document
 Hoffset = img.offsetHeight;
 Woffset = img.offsetWidth;
 img.style.left = xPos;  
 img.style.top = yPos;  

 if (yon) 
 {
  yPos = yPos + 5;
 } 
 else 
 { 
  yPos = yPos - 5;
 }
if(yPos < -Hoffset) 
 {
  yon = 1; yPos = -Hoffset;
 }
 if(yPos >= height) 
 {
  yon = 0; yPos = height;
 }
}
//-->
</Script>
</head>
<body>
<IMG id="img" style="POSITION: absolute" src="Images\Colored.jpg">
<SCRIPT language=JavaScript>
<!-- 
 var height = 0;
 var Hoffset = 0;
 var Woffset = 0;
 var yon = 0;  //false
 var xPos = 20;
 var yPos = document.body.clientHeight;
 var Timer1 = setInterval('changePos()',30);
//-->
</Script>
</BODY>
</HTML>

So my question is , how do I add a new image to this animation , and make it in a way that i alternates with the old one (Example : the image I have is colored , and I want to add a black&white image to it , so they alternate together !!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:29:44+00:00Added an answer on June 12, 2026 at 9:29 am

    to start off very simply, you could simply create an array of images:

    var images = new Array( "image1.jpg",
            "image2.jpg",
            "image3.jpg");
    

    Then you declare an img element in your html like :

    <img id="img1" src="image3.jpg" />
    

    And then just add this to your function:

    document.getElementById("img1").src = images[0] // or whatever image number you want.
    

    Have a look here:

    http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/131227/changing-images-in-html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<html> <head> <script language = javascript> show = function() { document.getElementById(name).innerHTML = window.opener.game.pl.guild.n; var
Sample code: <!DOCTYPE html> <html> <head> <title>test</title> <script language=javascript type=text/javascript> function init() { var
Consider the following HTML: (Written for Google Chrome) <html> <head> <script language=javascript> function AddToIFrame(){
See example: <!DOCTYPE html> <html> <head> <title>language</title> <script type=text/javascript src=http://www.google.com/jsapi> </script> </head> <body> <div
I have the following code <xsl:result-document href=output1/output3/index.html format=html> <html> <head> <SCRIPT LANGUAGE=JavaScript> function getParams()
Take a look at this html: <head> <title>Test page</title> <script type=text/javascript> function submitForm() {
#!/usr/bin/perl print Content-type: text/html \n\n; print qq(<html> <head> <script type=text/javascript src=/jquery.js></script> <script> jQuery(document).ready(function(){ jQuery(#form_lang).submit(function(e){
<html> <head> <style type=text/css> #navigator a { display: none; } </style> <script type=text/javascript> function
Look at this script: <html> <head> <style> #g{ display:none; } </style> <a href=# onMOUSEOVER=document.getElementById('g').style.display='block'>
I am runing the following jquery script: <html> <head> <script type=text/javascript src=jquery.js></script> <script type=text/javascript>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.