Set Margins With Javascript?

Can I set a marginwidth with javascript? I was thinking of something like this:


<script language="javascript">
function getSize() {
  if(navigator.appName == 'Netscape'){
  	var winWidth = window.innerWidth;
	var midWidth = winWidth/2 - 476;
	var theDiv = document.getElementById("divID");
	theDiv.style.marginLeft = 300;

  }
}
</script>
</head>
<body bgcolor="#193e5e" style="margin: 0px;" onLoad="getSize();">

of course that is now working:(