Loading Screen - Glitchyness

As some of you may/may not know I am a noob at PHP/HTML but with what I did know I put together this.


<script>
function SetFilesTotal( fileName )
	{
	document.writeln(fileName);
	}
	
	function SetStatusChanged( status )
	{
	document.writeln(status);
	}
</script>

<?php
//Get the steamid (really the community id)
$communityid = $_GET["steamid"];
//Get the map name
$mapname = $_GET["mapname"];
//See if the second number in the steamid (the auth server) is 0 or 1. Odd is 1, even is 0
$authserver = bcsub( $communityid, '76561197960265728' ) & 1;
//Get the third number of the steamid
$authid = ( bcsub( $communityid, '76561197960265728' ) - $authserver ) / 2;
//Concatenate the STEAM_ prefix and the first number, which is always 0, as well as colons with the other two numbers
$steamid = "STEAM_0:$authserver:$authid";

require_once('lib/steam-condenser.php');
$steamUser = new SteamId($communityid);
$nickname = $steamUser->getNickname();

?>
<body background="load.jpg">
<center>
<FONT COLOR="#01A9DB">
<p style="font-size:xx-large;">
Welcome back <?php echo "$steamid, $nickname"; ?>
</p>
<p style="font-size:x-large;">
Comunity ID <?php echo "$communityid"; ?>, Auth Server <?php echo "$authserver"; ?>
</p>
<p style="font-size:xx-large;">
Your on your way to <?php echo "$mapname"; ?>
</p>
<script>
SetStatusChanged();
SetFilesTotal();
</script>
<img src="/gmod/load.gif" alt="">

</div>
</FONT>
</center>

Here is a video:

**^^^ Ignore the cleveland show in the background, I forgot to mute my mic. ^^^**

As you see each time any of the javascript functions update it goes to a wierd black and grey screen, what it should do is display it under the previous text!
Why does it happen? Did I mis-configure something in SRCDS?

Seriously, when you make this sort of stuff, you should actually try to figure out what you are doing, instead of just copy pasting a bunch of stuff together.

Why are you calling the functions manually, at the end of the body? I’ve never actually used that feature, but I’m sure the game actually calls them. Correct me if I’m wrong, which I probably am.

Like I said, I am a noob at PHP/HTML if it works I shall settle but it does not.

Yeah, I was right.