html - Javascript - checking if frame is empty -> TypeError: e is null -
i tried check if frame "content1" , "content3" empty or not , resizing them.
but error:
"typeerror: e null"
window.setinterval(function(){ check(); }, 50); function check() { var content1 = document.getelementsbyname("content")[0].contentdocument.body; var content3 = document.getelementsbyname("content3")[0].contentdocument.body; if(isempty(content3)) { if(isempty(content1)) setproperties("0px, *, 0px"); else setproperties("35%, *, 0px"); } else setproperties("25%, 40%, 35%"); window.localstorage.clear(); } function isempty(e) { return (e.offsetwidth!=0 || e.innerhtml!="\n"); } function setproperties(value) { document.getelementsbytagname("frameset")[1].cols = value; }
referencing jsfiddle, seems issue doctype. changing dtd under fiddle options "html 4.01 frameset" seems correct issue.
it seems frame elements not exist in document otherwise. getelementsbyname not return them, , tried changing things use id , had same issue.
Comments
Post a Comment