// initially_andstyle.js // Dynamic Styling // RJM Programming // May, 2018 var cks=['-1']; var ans=''; var isid=0, jsid=0; var alreadydone=''; var player1has=''; var player2has=''; var onetwo=[1,2]; var rdone=false; var charis=['X','0']; var ccol=['yellow','pink']; var eog=''; var precursor='Dynamic Styling - RJM Programming - May, 2018 ... '; var tag; // = document.createElement('script'); var tagdiv; // = document.createElement('script'); var firstScriptTag; // = document.getElementsByTagName('script')[0]; var firstStyleTag; function bcolo() { var bs='none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|initial|inherit'.split('|'); var bc='#'; var bbc='#'; var ibs=Math.floor(Math.random() * bs.length); for (var ii=1; ii<=6; ii++) { bc+=('' + Math.floor(Math.random() * 15)).replace('15','f').replace('14','e').replace('13','d').replace('12','c').replace('11','b').replace('10','a'); bbc+=('' + Math.floor(Math.random() * 15)).replace('15','f').replace('14','e').replace('13','d').replace('12','c').replace('11','b').replace('10','a'); } bc+=' !important; border: ' + Math.floor(Math.random() * 6) + 'px ' + bs[ibs] + ' ' + bbc; return bc; } function nextone() { jsid++; tag = document.createElement('style'); tag.id = 'mystyle' + jsid; tag.innerHTML = String.fromCharCode(10) + " #div" + jsid + " { position:absolute; top: " + Math.floor(Math.random() * 95) + "% !important; left: " + Math.floor(Math.random() * 95) + "% !important; width: " + Math.floor(Math.random() * 185) + "px !important; height: " + Math.floor(Math.random() * 185) + "px !important; background-color: " + bcolo() + " !important; } "; firstStyleTag = document.getElementsByTagName('script')[eval(-1 + document.getElementsByTagName('script').length)]; for (isid=eval(-1 + jsid); isid>=1; isid--) { tag.innerHTML += String.fromCharCode(10) + " #div" + isid + " { position:absolute; top: " + Math.floor(Math.random() * 95) + "% !important; left: " + Math.floor(Math.random() * 95) + "% !important; width: " + Math.floor(Math.random() * 185) + "px !important; height: " + Math.floor(Math.random() * 185) + "px !important; background-color: " + bcolo() + " !important; } "; } document.body.innerHTML+='
'; document.body.appendChild(tag); //(tag, firstStyleTag); } setInterval(nextone, 2000);