-1
所以,我把劇本從互聯網上偷走了。基本上,它應該調整一個iframe以適應其內容。JavaScript在IE中不起作用?
function sizeIFrame()
{
var helpFrame = jQuery("#elastic");
var innerDoc = (helpFrame.get(0).contentDocument) ? helpFrame.get(0).contentDocument : helpFrame.get(0).contentWindow.document;
helpFrame.height(innerDoc.body.scrollHeight + 35);
}
雖然在Internet Explorer中似乎不起作用! iframe源位於同一臺服務器上,所以不應該成爲問題。任何想法有什麼不對? iframe ID是#elastic
。我已經在Firefox,Chrome和Safari中測試過了,它可以像所有應用程序一樣適用於所有三種。
編輯
我決定只更換另一種更沉重的jQuery解決方案的腳本。雖然它不像我希望的那樣輕巧,但它似乎可行。
請參見:http://sonspring.com/journal/jquery-iframe-sizing