Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old October 6th, 2008, 04:57 PM
Registered User
 
Join Date: Sep 2008
Location: Indian Rocks Beach, FL, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default playing SWF sound onmouseover

Hi,
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,
Rich

  #2 (permalink)  
Old October 6th, 2008, 06:12 PM
jminatel's Avatar
Wrox Staff
Points: 17,906, Level: 58
Points: 17,906, Level: 58 Points: 17,906, Level: 58 Points: 17,906, Level: 58
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2003
Location: Indianapolis, IN, USA.
Posts: 1,906
Thanks: 62
Thanked 139 Times in 101 Posts
Default

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
  #3 (permalink)  
Old October 7th, 2008, 02:09 PM
Registered User
 
Join Date: Sep 2008
Location: Indian Rocks Beach, FL, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
================================================== ======================
<head>
  <title></title>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
</head>

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


<body>
<a href="http://www.w3schools.com" target="_blank"
onmouseover="mouseOver()"
onmouseout="mouseOut()">
<img border="0" alt="cbells.swf"
src="juke.jpg" name="b1" /></a>
</body>
</html>


</body>
</html>




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.