Toggle And Sound For Image Swap?
Jun 7, 2010I have an on/off image piece of code: (probably out of date!)
<!--
var NN3 = false;
image1= new Image();
[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've got the toggle part of this file down across multiple browsers, but now I'm hoping someone can help me with making each link an image swap onClick. Code:
View 6 Replies View RelatedI 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]....
Could 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 Replies View RelatedI am a complete novice with Javascript, but am trying to work out how I can get a button to swap to another image when clicked, and each image have a different URL attached. I want to use this to toggle the bgcolor of my page using this script:
Code:
<script type="text/javascript">
<!--
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
[Code]...
I 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 RelatedI am trying to make a point and click javascript game. Basically what I want is to have one image displayed on screen at the start (room1.jpg). When you click on a door on that image, I have an onclick event to change the image to a new one that shows the door open (room1_a.jpg). What I want is that when you click the now open door, to display the next room in the game. The only solution I can think of is some sort of nested onclick event using several image maps, but I am fairly new to Javascript and I am not sure if that is possible. What it all comes down to is I want to display each incarnation of each room in the game in the same window without having to reload a new window for each room. I hope that makes sense, if not I can try and clarify. Below is the code I have so far. And as you can see all that does is display the open door when you click on the image. I have not done any of the image mapping yet.
[Code]...
I am trying to put together a purse shopping site - I would like to have the various views of the same purse in thumbnails under one image then when the customer clicks on the thumbnail the larger image will go into the viewing area. The general layout is like this page - [URL] So when someone clicks on the smallest image I would like it to replace the other image on the page and the larger image becomes the thumbnail. How is this accomplished?
View 2 Replies View RelatedI'm trying to use javascript to load an image on a webpage when another image is clicked on, just like an image gallery and just like this except I don't need any text: [URL] I copied the example above but when I click on the smaller image to load the larger one it works for a fraction of a second (I can see the image load in the right spot), but then the browser goes to the URL of the image instead (showing it on a blank page).
[Code]....
I'm loving this: Sliding Login Panel with jQuery 1.3.2 However, I'd like it to work so the 'Close Panel' link actually appears in the #panel itself and doesn't swap/toggle with the 'Login | Register' part.
View 5 Replies View RelatedI'm failing to get a pure CSS way to achieve this, so trying JS. Several small images in a row, each different. Want mouseover to:
1. change each image to different image on mouseover (each image has its own mouseover image version).
2. produce different paragraph of text below row of images on each mouseover.
I can achieve it with mouseover on text links or on an image, but not with the two events, viz mouseover image swap + mouseover text swap. Would also want to be able to style the text.
I have four links that use graphics to create an unvisited and visited state (using CSS). The link actually changes a section of text elsewhere on that page, so the user doesn't leave the page. The clicked, visited graphic reflects what text you are reading. You can then select a different link, and new text reflects the link you clicked on. What goes wrong is that if you click all four links, you eventually get all four visited graphics showing.
What I want is this. You click on the graphic and the graphic changes to visited. You then select a different link and that state goes to visited but the previous link that is visited too, changes back to unvisited. Therefore when you click on any link, that visited state is shown, and all others always reset to unvisited. The results is that the visited graphic reflects the current text on that page.
Is 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 RelatedI am looking to find a javascript that image swaps 4 button images that are to be used as links.
There will be an unvisited button (color of my choice)
There will be a hover state which Is green.
There will be a visited link button that is purple.
There will be a currently active page button that will be red.
I have a script that works for 3 of the for states.
The script that I have also will not keep the purple, visited state, as standard text based links will when a page has allready been visited.
Does anyone have a script that will work for what I want to do for all states.
I don't know how to build a script of my own, but plan on learning.
Does anyone have a script that will work for what I want to do for all 4 link/swap states that I want incorporated?
capturing just the file name rather than the entire path of the SRC on my input type="image". Basically when I hover over an image, the Default Image should change to the image being hovered on. Here is my code, can't quite get it to work. Sorry I'm very new to JavaScript
<html>
<head>
<script language = "Javascript">
function ChangeDefault(src)
{
//document.frmMain.DefaultImage.src = src <--Doesn't work at all
alert(src) //<---Displays the entire file path, want just file name
[Code]...
Lets say I have two images in a box
<body>
<div id="box">
<img src="image1.jpg" id="image1" width="100" height="100" />
<img src="image2.jpg" id="image2" width="100" height="100" />
</div>
</body>
When I click on Image1 I want Image2 to get replaced with a new image, called Image3. So I tried this code:
[Code]...
But instead of replacing the image on click, from some reason it replaces image2 with image3 from start/load.
I tried a Javascript on my homepage that works fine on Netscape, works
nearlyx normal on Opera but does not work at all on Internet Explorer. Is
there anybody out there who can help? I use a frameset of 3 frames. One of
these Frames has thumbnails with the javascript code for the image-swap -
the big picture should change whenever someone clicks on the corresponding
thumb. Code:
I'm looking for a solution that can be used in a calendar/gig guide
scenario where each day is represented by a dot image. Now this dot must
do the following
1. When the mouse goes over the dot image it swaps to the mouseover dot
2. When the mouse goes out of the dot image it restores back to the
original img
3. When the img is clicked the dot image is swapped with another image
(different to the other 2) that will remain there even when the mouse
goes out of the image
I have a portfolio page which loads a dozen thumbnails and one large image.
A friend helped me code a script (below) which will swap out the large image
(named "imgLarg") when a different thumbnail is clicked. Both the thumbnail
and the enlargement are identically named, one is in /thumbs/ and one is in
/enlargements/ - tricky, huh? ;-) What's the easiest way to make this work
in other browsers as well?
<script language="JavaScript">
function enlarge() {
oSrcElem = event.srcElement;
imgLarge.src = oSrcElem.src.replace(/thumbs/,'images');
}
</script>
Below is the routine I am using that when invoked swaps images for other images:
<script>
function swapImage(swapContName) {
if (swapContName == 'mainImage1') {
[code]....
But one of the images I would like to vanish (using the empty spacer.gif) has a border:
<img id="instructflag" border="1" src="FLAG.gif" width="23" height="15" align="left">
It must have this black border, but when it gets swapped for a blank, I am left with the black square. how to vanish the border along with the graphic?(I have some vague idea that "border" is not used any more, but anyway...).
how to veiw this eval's out put?
function doButtons(picimage) {
eval("document['picture'].src = " + picimage + ".src");
}
<?php
// to change the image size within the web page
function imageResize($width, $height, $target) {
//takes the larger size of the width and height and applies the formula accordingly...
//this is so this script will work dynamically with any size image
[Code]....
Just want to swap an image (thumb) for a larger one - in the same spot - then click on the large image and go back to the small one.
Nothing I have tried works but I KNOW it can be done - can't it?
The problem i'm having is simply getting an image to swap on a mouseover. Well I sort of had it working but then I cahnged the function to try and accomodate for more images and it just fell over dead.
Let me show you the function I have for it. Bear in mind I'm used to coding but more PHP and VB rather than JavaScript
<script language="javascript1.5">
Rollimage = new Array()
Rollimage[0] = new Image(244,244)
Rollimage[0].src = "images/personal_up.png"
[Code]....
BTW I have searched google and read many articles on this but still can't get it to work. Also I have searched previous articles on DaniWeb and again none solve the problem.
The address of the page is [URL]