![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread |
|
|
PM User | #1 |
|
Regular Coder ![]() Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
![]() |
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
|
|
|
|
|
|
PM User | #2 |
|
Regular Coder ![]() Join Date: Mar 2006
Posts: 495
Thanks: 14
Thanked 81 Times in 78 Posts
![]() |
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. |
|
|
|
| Users who have thanked mrhoo for this post: | cincinnatiboy4867 (11-29-2008) |
|
|
PM User | #3 |
|
Regular Coder ![]() Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
![]() |
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
|
|
|
|
|
|
PM User | #4 |
|
Senior Coder ![]() Join Date: Sep 2007
Location: Houston
Posts: 2,822
Thanks: 10
Thanked 237 Times in 228 Posts
![]() ![]() |
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. |
|
|
|
|
|
PM User | #5 | |
|
Supreme Master coder! ![]() ![]() Join Date: Dec 2004
Location: In a place far, far away...
Posts: 18,155
Thanks: 2
Thanked 866 Times in 845 Posts
![]() ![]() ![]() ![]() ![]() |
Quote:
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
|
|
|
|
|
| Users who have thanked _Aerospace_Eng_ for this post: | cincinnatiboy4867 (11-30-2008) |
|
|
PM User | #7 |
|
Regular Coder ![]() Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
![]() |
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("button" ;button.style.fontSize = "4em"; button.innerHTML = "Play Me! Play Me!" 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("embed" ;embedEl.setAttribute("src", uri); embedEl.setAttribute("hidden", true); embedEl.setAttribute("autostart", 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 |
|
|
|
|
|
PM User | #8 |
|
Regular Coder ![]() Join Date: Nov 2008
Posts: 314
Thanks: 159
Thanked 0 Times in 0 Posts
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Tags |
| css, html, javascript, music, player |
| Thread Tools | |
| Rate This Thread | |
|
|