M.O.S. Studios Posted February 3, 2010 Share Posted February 3, 2010 here is a js function I found on-line that I'm altering for a auto suggest feature on my site. // Shows a box if it wasn't shown yet or is hidden // or hides it if it is currently shown function show_hide_box(an, width, height, borderStyle) { setTimeout('closebox()', 50000); var href = 'autosuggest.php?input='+an.value; var boxdiv = document.getElementById(href); if (boxdiv != null) { if (boxdiv.style.display=='none') { hide_other_alone(boxdiv); // Show existing box, move it // if document changed layout move_box(an, boxdiv); boxdiv.style.display='block'; // Workaround for Konqueror/Safari if (!boxdiv.contents.contentWindow) boxdiv.contents.src = href; } else // Hide currently shown box. boxdiv.style.display='none'; return false; } hide_other_alone(null); // Create box object through DOM boxdiv = document.createElement('div'); // Assign id equalling to the document it will show boxdiv.setAttribute('id', href); // Add object identification variable boxdiv.alonePopupBox = 1; boxdiv.style.display = 'block'; boxdiv.style.position = 'absolute'; boxdiv.style.height = '100px'; document.body.appendChild(boxdiv); var offset = 0; var contents = document.createElement('iframe'); contents.scrolling = 'auto'; contents.overflowX = 'hidden'; contents.overflowY = 'auto'; contents.frameBorder = '0'; contents.style.width = width + 'px'; contents.style.height = (height - offset) + 'px'; boxdiv.contents = contents; boxdiv.appendChild(contents); move_box(an, boxdiv); if (contents.contentWindow) contents.contentWindow.document.location.replace( href); else contents.src = href; // The script has successfully shown the box, // prevent hyperlink navigation. return false; } I want to change boxdiv.style.height = '100%'; so that it is the same size as the contents within it. at the moment its the size as the actual page which is not what I want. any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.