Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 6th, 2008, 04:57 PM
Registered User
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default playing SWF sound onmouseover

I've been trying to get a song to play when the mouse rolls over an image on my webpage. I've had only partial success in that I get the music to play when the page comes up. The mouse does nothing. Does anybody know how to do this?
I've tried with and without javascript and cannot get it to work. If I ever do get it to work, I would like the music to stop when the mouse leaves the image.
Any help would be appreciated,

Old October 6th, 2008, 06:12 PM
jminatel's Avatar
Wrox Staff
Points: 18,059, Level: 58
Points: 18,059, Level: 58 Points: 18,059, Level: 58 Points: 18,059, Level: 58
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2003
Posts: 1,906
Thanks: 62
Thanked 139 Times in 101 Posts

Rich: Do you want to share the JavaScript you've tried so far?

Jim Minatel
Acquisitions Director
Wiley Technology Publishing
WROX Press
Blog: http://wroxblog.typepad.com/
Wrox online library: http://wrox.books24x7.com
Old October 7th, 2008, 02:09 PM
Registered User
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Jim,
I've tried tons of scripts and I believe this is where I left off. I've been around and around so I've probably done this one before and do not remember.
================================================== ======================
  <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>

<script type="text/javascript">
function mouseOver()
document.b1.src ="cbells.swf";
function mouseOut()
document.b1.src ="juke.jpg";

<a href="http://www.w3schools.com" target="_blank"
<img border="0" alt="cbells.swf"
src="juke.jpg" name="b1" /></a>


Similar Threads
Thread Thread Starter Forum Replies Last Post
playing sound files (java 2 jdk1.3 edition) naresh Java Basics 1 April 11th, 2009 01:04 AM
How to playing music in C#? Viet Hoang C# 2005 4 June 13th, 2006 03:51 AM
playing with textbox ninjai ASP.NET 1.0 and 1.1 Basics 1 September 24th, 2005 12:38 PM
Playing music in C# Fightfish C# 0 June 26th, 2005 08:09 AM
Playing a WAV without interupting sub shadowpug VB.NET 2002/2003 Basics 5 July 5th, 2003 10:24 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.