ehm, no decisamente non puoi fare cosi. Devi mettere un id all'elemento che vuoi modificare con JS:

codice:
<table width="950" height="210" border="0" cellpadding="0" cellspacing="0" id = "TheTable" >
e poi inserire il JS:

codice:
<script language="javascript" type="text/javascript"> 
   window.onload = function(){
      var bg = immagine_variabile();
      var tbl = document.all ? document.all["TheTable"] : document.getElementById("TheTable");
      tbl.setAttribute("background", bg);
   }
 </script>