mentalist Posted August 30, 2010 Share Posted August 30, 2010 Hi, I can embed an audio file and get it to play and stop, but I don't seem to be able to hide the big box it comes with and still play the file... Any ideas? <div style='display:none;'>x<embed id='sound' src='' width='1px' height='1px'></div> <script> function PlaySound(url){ document.getElementById('sound').src=url; } </script> <a href="#" onmouseover="PlaySound('src/2_for_joy_-_in_a_state.mp3')">Play</a> <a href="#" onmouseover="PlaySound('');">Stop</a> Also how browser safe is the underlying sound playing code? What do you use to play audio? Link to comment https://forums.phpfreaks.com/topic/212086-playing-audio/ Share on other sites More sharing options...
Omirion Posted August 30, 2010 Share Posted August 30, 2010 I have no idea about sound but you might try this. Just add an ID or Class or whatever to the container. And give it these CSS properties. position:absolute; left:-100px; Or whatever it takes to get it out of the screen. Link to comment https://forums.phpfreaks.com/topic/212086-playing-audio/#findComment-1105353 Share on other sites More sharing options...
mentalist Posted August 31, 2010 Author Share Posted August 31, 2010 Omirion, it's cheeky, but I like it... Many thanks! Link to comment https://forums.phpfreaks.com/topic/212086-playing-audio/#findComment-1105576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.