The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> CHANGING IMAGE
Mattab0lism
post Jun 19 2018, 08:10 PM
Post #1





Group: Members
Posts: 5
Joined: 16-June 18
Member No.: 26,660



Can someone point out what code is stopping these two parts working alongside eachother please smile.gif


<div>
<!IMAGE SWAPPER>
<script type="text/javascript" id="1">
var image_tracker = 'POSTER1';
function change(){
var image = document.getElementById('P1');
if(image_tracker=='POSTER1'){
image.src='images/2018-06-17 15.21.07 4.png';
image_tracker='POSTER2';
}
else{
image.src='images/1_0000.gif';
image_tracker='POSTER1';
}
}
</script>
</div>
<div>
<!IMAGE SWAPPER>
<script type="text/javascript" id="2">
var image_tracker = 'POSTER3';
function change(){
var image = document.getElementById('P2');
if(image_tracker=='POSTER3'){
image.src='images/arikara.png';
image_tracker='POSTER4';
}
else{
image.src='images/arikara.gif';
image_tracker='POSTER3';
}
}
</script>
</div>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
pandy
post Jun 19 2018, 09:10 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,731
Joined: 9-August 06
Member No.: 6



Maybe that you use the same variable name (image_tracker) in both scripts.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 02:53 PM