Script With Image Mouseovers And Sound?
Apr 14, 2001Could someone point me in the direction of a script that allows you to have an image change on MouseOver and plays a sound at the same time?
View 1 RepliesCould someone point me in the direction of a script that allows you to have an image change on MouseOver and plays a sound at the same time?
View 1 RepliesI am trying to use the following code to make the source of a embedded sound switch to different sound files based on which link is clicked:
javascript:
scales=Array("sounds/scales/Mscale.wma", "sounds/scales/hminscale.wma", "sounds/scales/nminscale.wma", "sounds/scales/mminscale.wma", "sounds/scales/chrscale.wma");
function Mscale() {
[Code].....
Below is the script. Just insert the name of your sound file where it says car3.wav.
At some point, the script turns from a sound loader into an image loader -- that begins at this line:
if (document.images)
<script LANGUAGE="JavaScript">
var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "car3.wav";
// DO NOT edit below this line
document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;
function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = ''
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:''
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
if (document.images)
{img1on = new Image();
img1on.src = "CI-on.gif";
img1off = new Image();
img1off.src = "CI-off.gif";}
function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "on.src");}
}
function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "off.src");}
}
//
</script>
There are five links buttons in the demo but only the introduction of "img1" is shown in this sample script.
In the document body, an anchor uses an onMouseOver to call for both the image flip AND the sound play.
Then it uses an onMouseOut to both revert the image and stop the sound play.
<P><A HREF="http://www.jeffs-icons.net/RZ/CI-F.html" TARGET=_top onMouseOver="imgOn('img1'), playSound(0)" onMouseOut="stopSound(0), imgOff('img1')"><IMG SRC="CI-off.gif" NAME="img1" border=0 ALT="Club Info"></A>
I've got a script at present which allows me to cycle through images stored in an array as a slide show on a timed basis per each one.What I would like to do is have a 2nd array which has .wav files and when the first image is shown the first sound clip in the 2nd array plays and when finished the 2nd image shows followed by the playing of the 2nd sound clip in the array.If It is not possible to move images when the sound finishes I will set the length but would like to play the sound clips with the image.My code is shown below :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
[code]....
I have an on/off image piece of code: (probably out of date!)
<!--
var NN3 = false;
image1= new Image();
[code]....
need a script that swap image and play sound on mouseover i already did the swaping image effect but i still need the sound to be played on mouseover .... the link is
View 1 Replies View RelatedI would like to play a .wav sound file when someone hovers their mouse/pointer over an image. I am running a Linux OS.
View 2 Replies View RelatedIs it possible to play a sound file when a visitor to my website moves their mouse/pointer over a single image no matter what browser they are using?
View 4 Replies View RelatedCode:
As far as I can tell, there seems to be a distinct lag time in IE before the switch from the 'off' to the 'on' image, and vice versa, which doesn't seem to exist in Mozilla.
Is this something that can be fixed by tweaking the script?
The script, btw, is pretty ancient, so I expect it may contain some outdated stuff. I found it years ago when looking for a script that would allow me to easily customize the number of target images changed by a single onmouseover/onmouseout action. Since I don't actually know javascript, I tend to stick with the ones I've learned to at least do basic customization of.
Can someone give me a quick tutorial on mouseovers in javascript with images?
View 1 Replies View Relateddocument.write("<td><a href=clips/"+genericname+".mpg document."+genericname+".dynsrc='clips/"+genericname+"mpg' src=logos/"+genericname+".jpg name="+genericname+" border=0></a></td>");
This line is meant to be used in conjunction with a loop routine in <script> brackets within the main <body>. What it should do is display a file pictures and then play its mpg file on a mouseover, for a generic filename that can be changed. That i can do. The problem is within the line ...
document."+genericname+".dynsrc='clips/"+genericname+"mpg'
Here i want to play the mpg and keep its height at 75. The problem is that it doesn't work. I think that the two document strings should be surrounded by "...
document."+genericname+".height=྇' document."+genericname+".dynsrc='clips/"+genericname+"mpg' "
However because i'm using the "+genericname+" command within the line, i can't use " to surround the two document strings. I've tried to do it as a function, but i can't get it to work as a generic function.
Does anyone know how to set up an IFRAME to scroll with mouseovers on links? For example, a text link that says "up" will scroll the frame up, a text link that says "down" will scroll the frame down.
View 2 Replies View RelatedI'm trying to get sounds to play on image mouseovers using dreamweaver
8, and I found out that the code it generates to do this only works
for IE. Is there a way to do this so that it will work with most of
the popular browsers? I don't care if it can be done with dreamweaver
or if I have to hand code or copy code from somewhere, I just want it
to work.
Here is what DW creates:
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
var i, method = "", sndObj = eval(_sndObj);
if (sndObj != null) {
if (navigator.appName == 'Netscape') method = "play";
else {
if (window.MM_WMP == null) {
window.MM_WMP = false;
for(i in sndObj) if (i == "ActiveMovie") {
window.MM_WMP = true; break;
} }
if (window.MM_WMP) method = "play";
else if (sndObj.FileName) method = "run";
} }
if (method) eval(_sndObj+"."+method+"()");
else window.location = sndFile;
}
<td align="center" bgcolor="#6699cc" onMouseOver="white4.bgColor='#ffffff'"
onMouseOver="this.bgColor='#993300'" onMouseOut="this.bgColor='#6699cc'"
onMouseOut="white4.bgColor='#6699cc'">
I am having a problem changing the color of 2 differnt table cells when
mouseing over of 1cell. The issue is I want to change the bgcolor of my cell
that I am mouseing over as well as an adjacent cell, but not the whole row.
The script changes only one, whichever the 1st one is and does not execute
the 2nd mouseover, it is probably a syntax problem but I was wondering if
anyone had any ideas
I'm using HTML 4 Strict and looking for a way to preload a sound.....
View 1 Replies View RelatedDoes anyone now where I can find a javascript that plays a .wav file when someone moves there mouse over an image? I was looking around for a while and the closest one I could find didn't work in Internet Explorer.
View 4 Replies View RelatedI need to create sound with Javascript. Until now all the code I have
been trying doesn't work width Firefox. can some one please show me
how to do it, or give me a link to a good article?
Is there any universal way (for all browsers) of using JavaScript to play some sound when you mouse over some link? If yes can somebody link me to this code or at least write me how one would do this?
View 5 Replies View RelatedHow can I play a sound when I click an image, without the information bar popping up at top? I've looked all over, and I've tried a few javascript-only methods but none have worked for me.. Is flash the only way to go?
View 1 Replies View RelatedI am developing a web application where each page shows a series of small jpg images each with an onClick event which plays a small mp3 file using javascript.
It all works perfectly but is a bit slow to load, so the customer wondered if we might develop a local version which, although the page was accessed via the web, the images and mp3s were installed on a users local pc (will be machine specific application anyway).
I have managed to do this for the images by using:
<img src="file:///C|/folder/home.jpg" onClick="EvalSound('shortname')">
and adding the site as a trusted site in IE7 (after much head scratching!).
However, my embed statement to embed the local mp3 files doesn't seem to work. I am using:
<embed src="file:///C|/folder/filename.mp3" autostart=false width=0 height=0 name="shortname" enablejavascript="true">
I have tried all sorts of versions of this path and nothing seems to work. I just get an 'unspecified error' when I click the image.
I have built an admin area for employees of a business. Once logged-in, if they sit idle for 5 minutes their session will be killed ( the time may vary depending on the employee ). I do all this with php but don't really know much about javascript.
What I would like to do is start playing a small sound repeatedly when the employees session is about 30 seconds from expiring. ( this will give the employee time to click on a link to keep their session alive )
So when the page loads, I would like to pass a length of time in seconds to a javascript. So if the employee can sit idle for 5 minutes, that would be 300 seconds. Minus the 30 seconds that I would like the alarm to be playing for which gives us 270 seconds. ( I'll pass this number to the script with PHP, the script does not have to figure this out... just to be clear. )
So I'm looking for something like this:
- On page load, tell javascript to count down a specific number of seconds ( 270 )
- When the countdown reaches 0, start playing sound file repeatedly.
Sounds easy enough but I haven't been able to find anything like this yet. The only ones I've seen actually display the countdown which I don't want. I want this to count down invisibly. Oh and it should hopefully work in both IE and Firefox.
can have a system(CPU) beep sound through JAVASCRIPT??
View 2 Replies View RelatedI can play a sound on my local machine, but when I upload to a server the same code it does not play. I cannot work out why, the link below gives the code. The multi channel code is here:
[URL]
I installed Firebug and insepcted the Net components and can see that the .wav files are being ought out but returning a 304 and then 404 error. This would be fine, however the path being sought is correct. Going to link does'nt play the sound, but removing the file and paring back to the directory brings you to the directory on the server and clicking the file does play the sound. The code works locally, and I simply cannot see what could be causing the issue in the server versions on both Firefox and Chrome.
I know this may sound stupid, but for the life of me I just can't seem to figure out how to code a sound being played every lets say 300 seconds.
View 1 Replies View RelatedI was wondering if there was a way to load a streaming/static
mp3, wav etc. with javascript and then beign able to control its
playing, pausing etc.
I don't have a clue what i'm doing with this and don't expect someone to just give me the code if it is actually possible (although it would be nice). I've created a site and in the admin area the page will update and tell me if there is a new message from a user, I have this page automatically refreshing every 5 minutes and wondered if it's possible to play a sound file if the term "unread" appears anywhere on the page?
View 3 Replies View Related