Jeśli chcesz, aby Twój kod sprawdzał poprawność, możesz to zrobić za pomocą javascript. Znalazłem doskonałą odpowiedź, gdy miałem ten problem kilka miesięcy temu here
var iframe = document.createElement("iframe");
iframe.src = "banner_728x90.gif";
iframe.width = "728";
iframe.height = "90";
iframe.frameBorder = "0";
iframe.scrolling = "no";
document.body.appendChild(iframe);
f chcesz załadować inną stronę bez szwu w iframe można to zrobić, jeśli skopiuj i wklej ten kod na czele swojej stronie . Znalazłem go na stronie z darmowymi skryptami. Spektakl jest dobre w większości przypadków
function getDocHeight(doc) {
doc = doc || document;
var body = doc.body, html = doc.documentElement;
var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
return height;
}
function setIframeHeight(id) {
var ifrm = document.getElementById(id);
var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;
ifrm.style.visibility = 'hidden';
ifrm.style.height = "10px"; // reset to minimal height in case going from longer to shorter doc
ifrm.style.height = getDocHeight(doc) + 10 + "px";
ifrm.style.visibility = 'visible';
}
wtedy dać iframe id i wywołać skrypt na obciążenia. Oto jak.
var iframe = document.createElement("iframe");
iframe.setAttribute('id', "ifrm1");
iframe.setAttribute('src', 'http://www.hekcmviw.com/'); // change the URL
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', '10');
iframe.setAttribute('frameBorder', '0');
iframe.setAttribute('scrolling', 'no');
iframe.setAttribute('onload' ,"setIframeHeight(this.id)");
document.body.appendChild(iframe);
StackOverflow ma wielki obszar podglądu poniższego pola tekstowego, w którym podać swoje pytanie. Użyj tego podglądu, aby naprawić formatowanie następnym razem przed opublikowaniem. – OregonGhost