View Single Post
Old 02-02-2013, 10:59 AM   PM User | #2
Airblader
Regular Coder

 
Join Date: Jan 2013
Location: Germany
Posts: 359
Thanks: 3
Thanked 43 Times in 43 Posts
Airblader can only hope to improve
Like this?

Code:
function getRandom(e,t){return Math.floor(Math.random()*(t-e+1))+e}function drawTable(){var e=document.getElementById("div1");var t=document.createElement("table");t.setAttribute("id","table_id");t.setAttribute("border","1");e.appendChild(t);var n=document.getElementById("table_id");var r=document.getElementById("div2");var i=" ";for(var s=0;s<10;s++){var o=document.createElement("tr");totalRows[s]=new Array(10);for(var u=0;u<10;u++){var a=document.createElement("td");a.setAttribute("width","100px");a.setAttribute("height","35px");var f=getRandom(0,1e3);if(f%2==0){totalRows[s][u]=document.createTextNode(getRandom(min,max))}else{var l=getRandom(0,1e3);if(l%2==0){totalRows[s][u]=document.createTextNode("+")}else{totalRows[s][u]=document.createTextNode("-")}}if(u%3===2){a.style.color="red"}a.appendChild(totalRows[s][u]);o.appendChild(a)}n.appendChild(o)}}var totalRows=new Array(10);var min=1;var max=10;drawTable()
I decided to post code that is as unreadable as yours. I strongly suggest you get an editor that supports intendation and that you actually use that to make your code somewhat readable.
Airblader is offline   Reply With Quote