Jump to content

Need help with a javascript problem


avibann

Recommended Posts

Hi to all,I am completely new to javascript. I got a school project to show <bgsound> with music controls. I have had managed to activate the play and stop button but failed to make the pause button work.Here is the code:

<html> <head><title> Music Player</title> <script language="javascript"> function m1() { s1.src=f1.value; a1.style.visibility="hidden"; a2.style.visibility="visible"; } function m2() { a1.style.visibility="visible"; a2.style.visibility="hidden"; } function m3() { s1.src=""; a1.style.visibility="visible"; a2.style.visibility="hidden"; } </script> </head> <body> <bgsound src="" id="s1"> <input type="file" id="f1"><br/><!--Play button starts--> <input type="button" value="Play" id="a1" onClick="m1()" style="position:absolute; visibility:visible"><!--Pause button starts--> <input type="button" value="Pause" id="a2" onClick="m2()" style="position:absolute; visibility:hidden">               <!--Stop button starts--> <input type="button" value="Stop" id="a3" onClick="m3()"> </body></html>
Now please help me how to make the pause button work. The <bgsound> is not the way to make a js music player, but the project I received is based on bgsound only. So please help me.
Link to comment
Share on other sites

Maybe bgsound doesn't support pause option. You can stop music, play from the begining, but can't pause.. I guess.. Couse stop and play, and pause are not standard bgsound options..

Link to comment
Share on other sites

With bgsound is can't be done because you can't directly control the player, you can just control what file given to the player.It's pointless to use bgsound because no browsers support it besides Internet Explorer so your viewers aren't going to hear the music.

Link to comment
Share on other sites

With bgsound is can't be done because you can't directly control the player, you can just control what file given to the player.It's pointless to use bgsound because no browsers support it besides Internet Explorer so your viewers aren't going to hear the music.
Hey thanks for the info. Actually i just started learning js so you know, teacher gave a task with bgsound. I came to know after few research that bgsound is not the way to do the work. However the teacher wanted to make search if any option possible with bgsound just to make our concepts clear, maybe.But loads of thanks.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...