I want to set "div" alignment to center using javascript. The reason using javascript is not working of "margin:auto" in IE.
I have coded :
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>
All Time Set Window
</title>
<script language="JavaScript" type="text/javascript">
$(document).ready(
var winSize = $(window).width();
var margin = winSize % 10;
function setMargin(){
$('#main').css({'margin-left':margin,'margin-right':margin});
}
)
</script>
</head>
<body>
<div id="main" align="center" style="width:1000px; height:100%; text-align:center; border: #000 solid 1px; margin:auto;">
<div id="inner1" style="width:100%; height:20%; background-color:#F8E0E0; float:top; border: #000 solid 1px;">
<div id="inner11" align="center">This is Header</div>
</div>
<div id="inner2" style="width:100%; height:60%; background-color:#F5F6CE; border: #000 solid 1px;">
<div id="inner21" align="center" style="width:70%; background-color:#E3F6CE; float:left;">This is Left Frame</div>
<div id="inner22" align="center" style="width:30%; background-color:#E0E0F8; float:right;">This is Right Frame</div>
</div>
<div id="inner3" style="width:100%; height:20%; float:bottom; background-color:#F8E0E0; border: #000 solid 1px;">
<div id="inner23" align="center">This is Footer</div>
</div>
</div>
</body>
</html>
But, still javascript code is not working properly. What can be the solution ?