• Music on this site doesnt work
    3 replies, posted
I made a loadingscreen for GMod and the loading music doesnt work,Ill post what i did below Index.php; [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title><?php include("include/title.txt"); ?></title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="js/background.js"></script> <script type="text/javascript" src="js/music.js"></script> <script type="text/javascript" src="js/timedmessage.js"></script> </head> <body onload="init();"> <div class="logo"><img src="<?php include("include/logo.txt"); ?>" /></div> <div class="entry"> <center> <b><div id="timedMsgDiv"></div></b> </center> </div> <div class="entry"> <center> <font size="2"> <center><b>Welcome to <?php include("include/communityname.txt"); ?>!</b></center> <br /> <center><b><?php include("include/downloadmessage.txt"); ?></b></center> <br /> <?php $MapName = isset($_GET['mapname']) ? $_GET['mapname'] : false; $Steam64 = isset($_GET['steamid']) ? $_GET['steamid'] : false; $authserver = bcsub($Steam64, '76561197960265728') & 1; $authid = (bcsub($Steam64, '76561197960265728')-$authserver)/2; $USERSTEAM = "STEAM_0:{$authserver}:{$authid}"; $EndMessage = file_get_contents('include/endmessage.txt'); echo "<center><b>Community ID: http://steamcommunity.com/profiles/{$Steam64}</b></center><br>"; echo "<center><b>Your SteamID: {$USERSTEAM}</b></center><br>"; echo "<center><b>Current map: {$MapName}</b></center><br>"; echo "<center><b>{$EndMessage}</center><br>"; ?> </font> </center> </div> <center><img src="images/loading.gif" /></center> </body> </html> [/CODE] js/music.js; [CODE] var sound1="music/sound1.ogg" var sound2="music/sound2.ogg" var sound3="music/sound3.ogg" var sound4="music/sound4.ogg" /* This part could get confusing if you don't know what you're doing. */ var x=Math.round(Math.random()*9) if (x==0) x=sound1 else if (x==1) x=sound2 else if (x==2) x=sound3 else if (x==3) x=sound4 else if (x==4) x=sound5 if (navigator.appName=="Safari") document.write('<object height="0" width="0" data='+'"'+x+'"'+'></object>') else document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="0" height="0" autostart="true" loop="true">') /* Credit to the original makers of the music *\ [/CODE] Music is in the correct place and still doesnt stream [url]www.hydrogengaming.co.uk/loadingscreen/music/sound4.ogg[/url]
its an issue with your javascript. you need to set the window.onload to some function if you want your script to be run window.onload=function(){writeMusicPlayerToWebPage()};
[QUOTE=asciid;41783567]its an issue with your javascript. you need to set the window.onload to some function if you want your script to be run window.onload=function(){writeMusicPlayerToWebPage()};[/QUOTE] I put that at the top?
[QUOTE=asciid;41783567]its an issue with your javascript. you need to set the window.onload to some function if you want your script to be run window.onload=function(){writeMusicPlayerToWebPage()};[/QUOTE] Why are you wrapping the function call in a closure? [code] window.onload = writeMusicPlayerToWebPage; [/code]
Sorry, you need to Log In to post a reply to this thread.