I am trying to change the horizontal positioning of an applet by changing the hspace attribute depending on the screen resolution. The Javascript below does not seem to change anything:
<html>
<body>
<applet
id="clientApplet"
archive="client.jar"
code="Client.class"
width="500" height="530"
hspace="100">
</applet>
<br />
<script type="text/javascript">
var leftMargin = (screen.width-500)/2;
document.getElementById("clientApplet").setAttribute(hspace, leftMargin);
window.location.reload()
</script>
</body>
</html>
Can anyone tell me where I am going wrong please?