div content doesn't fit text is wider than the specified area of div

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peterisaaclabeb
    New Member
    • Jan 2013
    • 1

    div content doesn't fit text is wider than the specified area of div

    I make a webpage which reads text from file and display it into a div
    the problem is that div content is wider than the div itself I have tried many codes but it works only if the content is pre-inserted into div

    the code i wrote in javascript is this

    Code:
    <script type="text/javascript" language="javascript">
        srcFrame;
        //External content into a layer
        function loadOuter(doc) {
        srcFrame = document.getElementById("hiddenContent");
        srcFrame.src = doc;
        // workaround for missing onLoad event in IFRAME for NN6
        if (!srcFrame.onload) {
        setTimeout("transferHTML()", 1000)
        }
        }
    
        function transferHTML()
        {
            srcContent='';
            if (srcFrame.contentDocument)
            {
              srcContent=srcFrame.contentDocument.getElementsByTagName("BODY")[0].innerHTML;
            }
            else if (srcFrame.contentWindow)
            {
                srcContent=srcFrame.contentWindow.document.body.innerHTML;
            }
            document.getElementById("Day").innerHTML =srcContent;
            
        }
        </script>
    Last edited by acoder; Jan 27 '13, 12:08 AM. Reason: Please use [code] tags when posting code
Working...