t = [25,28,18,10,37,31,20,29,39,29,35,31,23,18,41,12,17,12,12,12,22,26,26,31,17,25,20,25,35,12,16,38,25,20,15,23,14,17,36,26,13,15,29,5,15,11,28,41,17,25,36,7,21,25,12,38,49,26,32,36,45,45,15,25]; root = document.getElementById("sympla-widget-605365"); cw = root.clientWidth - 95; h = 205; for(i=0; i<64; i++) { l = Math.floor(t[i]/(cw/9))+1; h +=49; if(cw <= 154) h+=20; h += (l*15) + ((l-1)*5); } console.log(h); root.setAttribute("style", "max-width: 600px;"); ifrm = document.createElement("IFRAME"); ifrm.setAttribute("src", "https://www.sympla.com.br/tickets-grid-widget?eid=605365&lang=pt"); ifrm.setAttribute("id", "symplaw"); ifrm.setAttribute("frameborder", "0"); ifrm.setAttribute("vspace", "0"); ifrm.setAttribute("hspace", "0"); ifrm.setAttribute("marginheight", "0"); ifrm.setAttribute("marginwidth", "5"); if(root.getAttribute("height") == "auto" || root.getAttribute("height") == null) { ifrm.style.width = "100%";ifrm.style.height = h +"px"; } else { if(root.getAttribute("height") != null) { ifrm.style.width = "100%";ifrm.style.height = root.getAttribute("height")+"px"; } } while (root.firstChild) {root.removeChild(root.firstChild);} root.appendChild(ifrm);