...

View Full Version : background music script



montana
06-03-2006, 03:11 PM
I have a problem with this code :
<head>
<script language=javascript type="text/javascript">
function playSound()
{document.muzyka.play(false)}
function pause()
{document.muzyka.pauseSound()}
function stop()
{document.muzyka.stopSound()}
</script>
</head><body>
<embed src="mySound.wav" hidden=true autostart=false name="muzyka"
mastersound><p>
<form>
<input type="button" value="play" onClick="playSound()">
<input type="button" value="pause" onClick="pauseSound()">
<input type="button" value="stop" onClick="stopSound()">
</form>
</body></html>

and control panel (play, pause, stop) doesn't work. When i delete "hidden" i can listen to my sound file but my control panel still doesn't work. What's wrong? Where is an error?:rolleyes:

v777tony
06-03-2006, 10:17 PM
<script type="text/javascript">
function playSound()
{document.muzyka.play(false);}
function pauseSound()
{document.muzyka.pauseSound()}
function stopSound()
{document.muzyka.stopSound()}
</script>


Delete the part in blue. Because when you click the "play" button, it performs the fuction playsound() but in the code it says it's "false" (you only need the value "false" in the HTML). As for "stopSound()" and "pauseSound()". They aren't real functions.



<form>
<input type="button" value="play" onClick="playSound()">
<input type="button" value="pause" onClick="pauseSound()">
<input type="button" value="stop" onClick="stopSound()">
</form>


Be sure to delete these blue parts as well.

montana
06-04-2006, 02:57 PM
many thanks for your advice, but it still doesn't work. Maybe there is sth wrong with my browsers? Any suggestions?
best regards:rolleyes:

v777tony
06-06-2006, 08:56 PM
I checked the code myself so, it should work. But just follow the below instructions.

Make sure that other scripts aren't messing it up. Use the return(); function at the end of your scripts to prevent this (most of the time). Make sure the filepath is correct including extensions. Check code for typos. I don't know if it's your browser or not. But if it is, I recomend getting IE6(best browser ever). I also hear that IE7 it coming out also.

Also, make sure the script is in the right place. Oh, and don't use doctypes, they're useless.

:thumbsup:

v777tony
06-18-2006, 01:58 AM
Don't use doctypes, they're useless.

When I say "Don't use doctypes". I say this because the browser default is ussually better. You just have to know how to work things.

felgall
06-18-2006, 03:31 AM
When I say "Don't use doctypes". I say this because the browser default is ussually better. You just have to know how to work things.

What absolute nonsense. That statement is completely backwards. The browser default will definitely be WORSE because each browser default is different and so you end up with 10000+ different versions of your page only one of which might be okay.

The DOCTYPE is one of the most important parts of the page because by using a strict DOCTYPE and making sure the page validates to that DOCTYPE you ensure that all browsers will treat the page the same way. Without a DOCTYPE each browser will do its own thing and your page will look like garbage in at least some and probably most browsers.

There is no such tag as <embed> and so most browsers will ignore it completely. The <object> tag is for embedding ovjects into web pages.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum