Div element onload() workaround

less than 1 minute read


<P><FONT SIZE=2 FACE=”Arial”>P[lace a javascript section immediately behind the div,</FONT> </P> <P><FONT SIZE=2 FACE=”Arial”>        <div id="previewReportDiv" style="overflow:auto; width:900px; height:400px; border:solid 1px;"></FONT>
<FONT SIZE=2 FACE=”Arial”>        </div><script type="text/javascript"></FONT>
        <FONT SIZE=2 FACE=”Arial”>onload=function(){</FONT>
        <FONT SIZE=2 FACE=”Arial”>alert("here ");</FONT>
        <FONT SIZE=2 FACE=”Arial”>var resultDoc = ‘<c:out value="${report}" escapeXml="false"/>’;</FONT>
        <FONT SIZE=2 FACE=”Arial”>var div = document.createElement("div");</FONT>
                <FONT SIZE=2 FACE=”Arial”>div.innerHTML=resultDoc;</FONT>
                <FONT SIZE=2 FACE=”Arial”>alert(resultDoc);</FONT>
                <FONT SIZE=2 FACE=”Arial”>div.style.width=’900px’;</FONT>
                <FONT SIZE=2 FACE=”Arial”>div.style.height=’400px’;</FONT>
                <FONT SIZE=2 FACE=”Arial”>div.style.overflow=’auto’;</FONT>
                <FONT SIZE=2 FACE=”Arial”>div.style.border = "solid 1px #000000";</FONT>
                <FONT SIZE=2 FACE=”Arial”>Element.update(‘previewReportDiv’,div);</FONT>
<FONT SIZE=2 FACE=”Arial”>}</FONT>
<FONT SIZE=2 FACE=”Arial”></script></FONT> </P>

Categories:

Updated:

Leave a Comment