473,803 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a better way of clicking images in sequence?

Hello,

The code below works but can anyone suggest a better way of doing the
following?

The idea is that there are 3 images which when clicked each play a
different sound and change to a different image.

I want to have the user hear the sounds in sequence and also not to
play the next sound until the previous sound has finished.

Cheers

Geoff
<script type="text/javascript">
var egfinished1="no ";
var egfinished2="no ";
var egclicked1="no" ;
var egclicked2="no" ;
</script>

<h2>First Sound</h2>

<IMG alt="image" id="IMGa" src="../assets/images/play1.gif"
onClick="egclic ked1='yes';docu ment.getElement ById('IMGa').sr c='../assets/images/play2.gif';
soundManager.cr eateSound({id:' mySound1a',url: '../assets/audio/Track27.mp3',
onfinish:functi on(){egfinished 1='yes'}
});
soundManager.pl ay('mySound1a') ;
this.disabled=' true'">

<h2>Second Sound</h2>

<IMG alt="image" id="IMGb" src="../assets/images/play1.gif"
onClick="
egclicked2='yes ';
if (egclicked1 !='yes'){
alert('Play the first sound');
return;
} else {
if (egfinished1 == 'yes') {
document.getEle mentById('IMGb' ).src='../assets/images/play2.gif';

soundManager.cr eateSound({id:' mySound2a',url: '../assets/audio/Track28.mp3',
onfinish:functi on(){egfinished 2='yes'}});
soundManager.pl ay('mySound2a') ;
} else {
alert('click again when first sound finished');
return;
}
}
;this.disabled= 'true'">

<h2>Third Sound</h2>

<IMG alt="image" id="IMGc" src="../assets/images/play1.gif"
onClick="
if (egclicked1 !='yes'){
alert('Play the first sound');
return;
} else {
if (egclicked2 !='yes') {
alert('play the second sound');
return;
} else {
if (egfinished2==' yes') {
document.getEle mentById('IMGc' ).src='../assets/images/play2.gif';

soundManager.cr eateSound({id:' mySound3a',url: '../assets/audio/Track29.mp3'});
soundManager.pl ay('mySound3a') ;
} else {
alert('click again when second sound finished');
return;
}
}
}
;this.disabled= 'true'">
Jun 27 '08 #1
1 906
On Tue, 29 Apr 2008 13:44:00 +0100, Geoff Cox <gc**@freeuk.no tcom>
wrote:
I should have added that the 3 sets of code have to be separate as
there is descriptive text in between.

Cheers

Geoff
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1369
by: Richard | last post by:
www.somestuff.batcave.net Just a simple photo gallery of my own design. What I want to do works quite well in javascript. But I'm thinking it might be better off in php. Just a few thumbnails and one large image for testing purposes. Comments welcomed.
1
1624
by: PWalker | last post by:
Hi, I have several webpages that have around 50+ thumbnail images in it in a table structure spanning (3 columns) x (17+ rows). Each thumbnail is wrapped in the following piece of javascript: <a href="#" onClick="javascript:window.open('Images/image_name.jpg','window','width=430,height=560,resizable=yes')"> Now since there are so many thumbnails, the page needs to be scrolled to view the thumbnails at the bottom of the list. When i...
3
3749
by: Ricardo Sanchez | last post by:
Hello, I'm trying to upload images to http://imageshac.us via a Python script. I have looked at the POST request with HTTPLiveHeaders Firefox extension when I upload an image, but I can't figure what's wrong. (if I disable the cookies in the browser, it still works, so it's not that).
2
3569
by: chrisse_2 | last post by:
Hi, I am working with images which vary depending on what record you are looking at. The images are linked into my database using vba code. I would like the user to be able to double click on the image and have it open up in the respective program on the computer. Is this possible? Also, i have multiple images for some records. I have no problem setting up the code to view the images, the problem i am having is when you are scrolling...
14
1455
by: EdB | last post by:
We are having an odd problem saving images. We capture customer signatures on a Palm Pilot and save them as points on a graph. We are able to reconstruct these points to display the signature, but when we attempt to save the file off so that we can pass it back to our customers we get an odd result. If we try to view the file using Windows Picture and Fax viewer, everything's ok. But try to view it using any other graphics program (such...
10
2370
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images. That is, images inline with the actual content of the blog itself. Is there an example that I can be pointed to, where I can examine some code and figure out how to do this? Frankly I haven't got a clue, aside from breaking the content up into...
11
1298
by: Jason Camp | last post by:
Since we are unable to use IIS on our developer workstations due to security policy, we would like to use the internal web server baked into VS.NET 2005. The problem that I am currently running into is that we have many web applications that share common images and I don't know where to put them. I'm not able to create a virtual directory in "Cassini", so that's not a viable solution. I also don't want to copy all the shared images under an...
3
3192
by: vj | last post by:
how to change images based on action. Even clicking changed images should do respective actions. and while displaying only one image at a time sholud get displayed. I am using three images for a single column of a table in Jsp. Any clues. Any link for any good javascript html jsp site where i can find some good solution. here swaping hiding which will work well.
7
2001
by: Keith Hughitt | last post by:
Hi all, I am having trouble preloading images in a javascript application, and was wondering if anyone had any suggestions. Basically I have a bunch of images stored in a database as BLOBs. At any given point in time a subset of those images is displayed on- screen. At certains times I want to swap out those on screen with new ones from the database, and do some as seamlessly as possible. So what I've tried to do is first create Image...
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.