•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 370,605 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,039 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3656 | Replies: 6
![]() |
I have some music in the background of my website (Let it snow.mp3) - using the following code:
<script language="JavaScript"><!--
if(navigator.appName=="Netscape"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" controls="SmallConsole" width=50 height=15></embed>');}
else if(navigator.appName=="Microsoft Internet Explorer"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" width=70 height=25></embed>');}
else{
document.write('<embed src="let it snow.mp3" autostart="true" loop="true"></embed>');}
//-->
</script>
<noscript><embed src="let it snow.mp3" autostart="true" loop="true"></embed></noscript>
<noembed><bgsound src="let it snow.mp3" loop=true></noembed>
At the moment it starts playing automatically.
If the user is already listening to some music this can be annoying.
Would it be possible to have an alert box which comes up when the music is loaded saying something like:
Do you want to listen to "Let it Snow" by Chris Isaak while you browse my web site?
[Yes] [No]
Hope you can help
Martin
<script language="JavaScript"><!--
if(navigator.appName=="Netscape"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" controls="SmallConsole" width=50 height=15></embed>');}
else if(navigator.appName=="Microsoft Internet Explorer"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" width=70 height=25></embed>');}
else{
document.write('<embed src="let it snow.mp3" autostart="true" loop="true"></embed>');}
//-->
</script>
<noscript><embed src="let it snow.mp3" autostart="true" loop="true"></embed></noscript>
<noembed><bgsound src="let it snow.mp3" loop=true></noembed>
At the moment it starts playing automatically.
If the user is already listening to some music this can be annoying.
Would it be possible to have an alert box which comes up when the music is loaded saying something like:
Do you want to listen to "Let it Snow" by Chris Isaak while you browse my web site?
[Yes] [No]
Hope you can help
Martin
•
•
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation:
Rep Power: 9
Solved Threads: 18
Why not set autostart to false and set hidden to false? I THINK that would give some sort of musical icon they can click on to listen.
•
•
•
•
I have a problem. on my website, a flash player plays a background sound but when I refresh it or i change the page, it stops like it is available only at that page. what can I do to hear that sound on multiple pages of my site? please help me
Unless you make your entire site with flash, I think the only way to achieve this is to use frames - so your site pages run in one frame on a main page which just has that frame and your flash player on.
Hope this helps,
Martin
•
•
Join Date: Feb 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Thanks but I do not use frames because its ruining the design I think. Someone told me another way but VERY VERY COMPLICATED. To use a session in php or something like that to register the 'time of the song' when I change the page and to resume it on the other page in that session. Is anyone who tried this complicated method? I do not know how to control the sound like that.
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 916
Reputation:
Rep Power: 5
Solved Threads: 46
Err... you could remember where the song is and restart it at the correct place on every page; but getting it syncronized properly over the Internet will be hell. It would take a long time to implement, a long time to test, and might not ever work without noticeable gaps or jumps in the song.
A frame is probably your best bet. I wouldn't worry about it 'runing the design', no1 need ever see the frames, and theres no reason you can't place a conformant W3C strict XHTML page inside a conformant W3C frameset XHTML frameset document. The only issue with frames is you lose the ability to use the address bar effectively.
A frame is probably your best bet. I wouldn't worry about it 'runing the design', no1 need ever see the frames, and theres no reason you can't place a conformant W3C strict XHTML page inside a conformant W3C frameset XHTML frameset document. The only issue with frames is you lose the ability to use the address bar effectively.
If it only works in Internet Explorer; it doesn't work.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Multimedia: introducing the webbrowser module (Python Tutorials)
- how to import a background music? (Visual Basic 4 / 5 / 6)
- how to import background music (Visual Basic 4 / 5 / 6)
- Website music (Graphics and Multimedia)
- IPB vs. phpBB (Growing an Online Community)
- Please help fix the About:Blank (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: dreamweaver and browser compatibility
- Next Thread: Javscript Select onchange with ASP



Linear Mode