Blame | Last modification | View Log
<script src="/jquery.min.js"></script><div id="myeditable" contenteditable="true"></div><script type="text/javascript">/* the simplest method in the library */$("#myeditable").load("/test.html");</script>====================================================<script>function resizeIframe(obj) {obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';}</script>And change your iframe to this:<iframe src="..." frameborder="0" scrolling="no" onload="resizeIframe(this)" />===========================================================<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>JavaScript Auto Adjust iFrame Height Based on Content</title><style>iframe{width: 100%;border: 2px solid #ccc;}</style></head><body><iframe src="demo.php" id="myIframe"></iframe><script>// Selecting the iframe elementvar iframe = document.getElementById("myIframe");// Adjusting the iframe height onload eventiframe.onload = function(){iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';}</script></body></html>======================================================================================function autoResize(iFrame) {iFrame.width = iFrame.contentWindow.document.body.scrollWidth;iFrame.height = iFrame.contentWindow.document.body.scrollHeight;}<script>function autoResize() {var iframe = document.getElementById("myFrame");iframe.style.height = "1000px";iframe.style.width = "400px";}</script><div><iframe onload='autoResize()' id="myFrame" class='IDNAME' style='height:100%;width:100%;border:none;display: block;position: relative;overflow: hidden;' scrolling='no' src='/temp/c.html' type='text/html'></iframe></div>