Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 11-28-2008, 07:09 PM   PM User | #1
cincinnatiboy4867
Regular Coder

 
Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
cincinnatiboy4867 is an unknown quantity at this point
Question This code won't work in Firefox...

Hey guys, thanks for taking the time to help me out on this one...

Here is the coding that I'm trying to get to work on all browsers:

<html>

<div style="position:absolute;left:200px;top:300px;">
<bgsound src="#" id="play" autostart="true">
<img src="http://i346.photobucket.com/albums/p438/durkmusic /playbutton.png"
onclick="document.all.play.src='delete.mp3'">
</div>


<div style="position:absolute;left:200px;top:350px;">
<bgsound src="#" id="hitit" autostart="true">
<img src="http://i346.photobucket.com/albums/p438/durkmusic/playbutton.png"
onclick="document.all.play.src='cbl.wav'">
</div>


</html>

It's a simple button that plays a song when you click it. I have two of them. I have it setup so that you can't have both playing at the same time. I'm thinking there's something in firefox stoping the active x or whatever from running the script. The buttons show up but it won't play the song when you click it. Thanks for all your help
cincinnatiboy4867 is offline   Reply With Quote
Old 11-29-2008, 05:35 AM   PM User | #2
mrhoo
Regular Coder

 
Join Date: Mar 2006
Posts: 495
Thanks: 14
Thanked 81 Times in 78 Posts
mrhoo will become famous soon enough
Only IE has a bgsound element, and firefox doesn't support document.all to reference elements.
You need to use a plugin or embed (or object) element to play sound media in firefox.
mrhoo is online now   Reply With Quote
Users who have thanked mrhoo for this post:
cincinnatiboy4867 (11-29-2008)
Old 11-29-2008, 10:49 PM   PM User | #3
cincinnatiboy4867
Regular Coder

 
Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
cincinnatiboy4867 is an unknown quantity at this point
Where could I find a code like this:

I want people to press play and one song is played. On a different button another song can be played. I don't care if they have stop buttons as long as you can't have two songs going at once... and I don't want it to be like a music player (widget) or anything like that.

Thanks again for all your help
cincinnatiboy4867 is offline   Reply With Quote
Old 11-29-2008, 11:08 PM   PM User | #4
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,822
Thanks: 10
Thanked 237 Times in 228 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
You could use a framework, like Scriptaculous, which would provide cross browser sound features. You just have to download the framework, and then link to it in the header, and then follow the examples.

http://github.com/madrobby/scriptaculous/wikis/sound
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 11-30-2008, 07:25 AM   PM User | #5
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 18,155
Thanks: 2
Thanked 866 Times in 845 Posts
_Aerospace_Eng_ is just really nice_Aerospace_Eng_ is just really nice_Aerospace_Eng_ is just really nice_Aerospace_Eng_ is just really nice_Aerospace_Eng_ is just really nice
Quote:
Originally Posted by jeremywilken View Post
You could use a framework, like Scriptaculous, which would provide cross browser sound features. You just have to download the framework, and then link to it in the header, and then follow the examples.

http://github.com/madrobby/scriptaculous/wikis/sound
I couldn't get that to work in Firefox 3.0.4 even though it says it should work.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Users who have thanked _Aerospace_Eng_ for this post:
cincinnatiboy4867 (11-30-2008)
Old 11-30-2008, 02:19 PM   PM User | #6
cincinnatiboy4867
Regular Coder

 
Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
cincinnatiboy4867 is an unknown quantity at this point
Quote:
Originally Posted by _Aerospace_Eng_ View Post
I couldn't get that to work in Firefox 3.0.4 even though it says it should work.
Okay. Thanks for trying
cincinnatiboy4867 is offline   Reply With Quote
Old 11-30-2008, 02:52 PM   PM User | #7
cincinnatiboy4867
Regular Coder

 
Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
cincinnatiboy4867 is an unknown quantity at this point
Ok I think I found something that I want, I just can't get it to work...

<html>
<head>
</head>
<body>

<div title="JinglyPlugin" modifier="Mahemoff" created="200810212103"

modified="200810212206" tags="systemConfig" changecount="12">
<pre>config.macros.jingle = {}
config.macros.jingle.handler =

function(place,macroName,params,wikifier,paramString,tiddler) {

button = document.createElement(&quot;button&quot;
button.style.fontSize = &quot;4em&quot;;
button.innerHTML = &quot;Play Me! Play Me!&quot;

button.onclick = function(ev) {
startWav(SOUND_URL);
}
place.appendChild(button);

// cancel dbl-click so we can follow our natural urge to click on the button incessantly
story.getTiddler(tiddler.title).ondblclick = function() {}

}

// non-flash sound handling adapted from

http://www.zwitserloot.com/files/sou...oundcheck.html

var embedEl;

function startWav(uri) {
stopWav();
embedEl = document.createElement(&quot;embed&quot;
embedEl.setAttribute(&quot;src&quot;, uri);
embedEl.setAttribute(&quot;hidden&quot;, true);
embedEl.setAttribute(&quot;autostart&quot;, true);
document.body.appendChild(embedEl);
}

function stopWav() {
if (embedEl) document.body.removeChild(embedEl);
embedEl = null;
}

// To make a new sound, cut and paste into hixie's handy Data URI Kitchen
// http://software.hixie.ch/utilities/cgi/data/data.pl

var SOUND_URL="http://boxstr.com/files/4042953_pdwyk/mp3.mp3"</pre>
</div>

</body>
</html>


I'm probably doing something stupid which is why it doesn't work but it seems to work fine for this page:

http://mahemoff.com/project/tiddlywiki/jinglywiki.html
cincinnatiboy4867 is offline   Reply With Quote
Old 11-30-2008, 02:54 PM   PM User | #8
cincinnatiboy4867
Regular Coder

 
Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
cincinnatiboy4867 is an unknown quantity at this point
The code has to be in there somewhere...

Here's something else I ran across that seems simpler but I don't think you play it with a button:

Sound.play( url, [ options ])
Sound.enable()
Sound.disable()

and I don't know how to set it up either

Any help would be greatly appreciated.
cincinnatiboy4867 is offline   Reply With Quote
Reply

Bookmarks

Tags
css, html, javascript, music, player

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:34 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.