Well, nothing but IE understands document.all. That's your first problem. Now, assuming all of the HTML is correct, this script should work (in theory... don't have time to test):
Code:
<script language="javascript" type="text/javascript">
<!--
function play(s)
{
document.getElementsByTagName('bgsound')[0].src=s;
}
//-->
</script>
This *should* work in every DOM-capable browser. Of course, I'm not sure if bgsound is a valid tag...