simultaneaous image substitutions via javascript

  • Thread starter Thread starter TB
  • Start date Start date
T

TB

Hi everybody:

Could anybody help with a javascript or any similiar that would enable a
single click on an image (or text link for that matter) to produce multiple
and simultaneous substitions of other images on the same page? For example,
on a given page, there are four images: 1.gif, 2.gif, 3.gif and 4.gif. When
clicking on 1.gif, 2.gif is substituted by 2new.gif, 3.gif is substituted by
3new.gif and 4.gif is substituted by 4new.gif.

Thanks in advance.

Trym
 
Hi Trym,

Thank you for the posting. I understand you would like to simultaneaous
image substitutions via javascript.

There are many tools which can fulfill such a function.

http://www.jasc.com/tutorials/javanav.asp

In addition, if you would like to program yourself, please refer to the
following:


<script language=javascript>

function IMGupdate(ids,sources)

{

var IDList=ids.split(',');

var SourceList=sources.split(',');

var ImageCount=IDList.length;

var SourceCount=SourceList.length;

var n;

// at this point checking whether the two lists are the same length

// would probably be a good idea

if(ImageCount!=SourceList.length) return false;

for(n=1;n<ImageCount;n++)

{


document.images[IDList[n]].src='images/'+SourceList[n];

}

}

</script>



<body>

<a href="#"

onClick="IMGupdate('IMGa,IMGb,IMGc,IMGd','a.gif,b.gif,c.gif,d.gif');"><img
id="IMGa" src="images/1.gif"></a>



<img id="IMGb" src="images/2.gif">

<img id="IMGc" src="images/3.gif">

<img id="IMGc" src="images/4.gif">

</body>

Hope the above information and suggestion helps and answers your question.
If anything is unclear, please let me know.


Sincerely,

Cherry Qian
MCSE2000, MCSA2000, MCDBA2000
Microsoft Partner Online Support


Get Secure! - www.microsoft.com/security

====================================================
When responding to posts, please Reply to Group via your newsreader so
that others may learn and benefit from your issue.
====================================================
This posting is provided AS IS with no warranties, and confers no rights.
 
Back
Top