as has been noted, to do this "properly" you would probably create elements and align them using css, like this:
Code:
<head>
<style>
span{
width:30px;
float:left}
</style>
</head>
<body>
<script type="text/javascript">
for (var i = 1; i < 30; i++ ){
if (i%2 == 1){
var sp=document.createElement("span");
sp.innerHTML=i+" ";
document.body.appendChild(sp)
if (i==9||i==19){
document.body.appendChild(document.createElement("br"));
}
}
}
document.body.appendChild(document.createElement("br"));
document.body.appendChild(document.createElement("hr"));
</script>
</body>
but if you're just looking for quick and sleazy, but want to get away from document.write:
Code:
<script type="text/javascript">
for (var i = 1; i < 30; i++ ){
if (i%2 == 1){
if (i<10){
document.body.innerHTML+=i+" "
}
if (i>10){
document.body.innerHTML+=i+" "
}
if (i==9||i==19){
document.body.innerHTML+="<br>"
}
}
}
document.body.innerHTML+="<hr>"
</script>