php - A div fails to show html when its innerHTML is changed -
my div set show line of text , successfully. later in code set innerhtml of div show 15 lines of text , shows 1st line.
i thought block elements divs automatically 'grow' based on content -- , note i'm not using css affect div in 'hiding' overflow. note put 3-pixel-wide solid purple border around div visually assess size change 'innerhtml' 1 line of text 15 lines of text.
<div class="rbadslinksdiv" id="adlinksarea" style="border: 3px solid purple;"> <br />this 1 line of text replaced 15 lines of text.... </div>
when web page first appears, correctly shows 1 line of text in div:
this 1 line of text replaced 15 lines of text....
here css:
.rbadslinksdiv { margin-top: 5px; }
here php code generates javascript fill div 15 lines of new text:
$html = <<<heredoc "<br /><br /><b>1) hey ad links?</b><br /><br />" "<br /><br /><b>2) hey ad links?</b><br /><br />" "<br /><br /><b>3) hey ad links?</b><br /><br />" "<br /><br /><b>4) hey ad links?</b><br /><br />" "<br /><br /><b>5) hey ad links?</b><br /><br />" "<br /><br /><b>6) hey ad links?</b><br /><br />" "<br /><br /><b>7) hey ad links?</b><br /><br />" "<br /><br /><b>8) hey ad links?</b><br /><br />" "<br /><br /><b>9) hey ad links?</b><br /><br />" "<br /><br /><b>10) hey ad links?</b><br /><br />" "<br /><br /><b>11) hey ad links?</b><br /><br />" "<br /><br /><b>12) hey ad links?</b><br /><br />" "<br /><br /><b>13) hey ad links?</b><br /><br />" "<br /><br /><b>14) hey ad links?</b><br /><br />" "<br /><br /><b>15) hey ad links?</b><br /><br />" heredoc; $outstr = "document.getelementbyid('adlinksarea').innerhtml = $html"; echo $outstr;
to make sure 'outstr' correct, display contents of in iframe on web page , yes indeed, 15 lines of html code there.
i expected see 15 lines above see in div is:
1) hey ad links?
and other 14 lines missing.
i thought when update 'innerhtml' of div more content div should automatically expand show -- incorrect assumption on part? , if so, need div grows in size based on number of lines of text, not 15 lines?
one of things tried in attempting figure out instead of 1 line of text, div has 5 lines of text when first appears on page:
<div class="rbadslinksdiv" id="adlinksarea" style="border: 3px solid purple;"> <br />this 1 line of text replaced 15 lines of text.... <br />this 1 line of text replaced 15 lines of text.... <br />this 1 line of text replaced 15 lines of text.... <br />this 1 line of text replaced 15 lines of text.... <br />this 1 line of text replaced 15 lines of text.... </div>
the above shows correctly on web page -- in fact see 5 lines of above text on web page when page first loads.
1 line of text replaced 15 lines of text.... 1 line of text replaced 15 lines of text.... 1 line of text replaced 15 lines of text.... 1 line of text replaced 15 lines of text.... 1 line of text replaced 15 lines of text....
then change 'innerhtml' of div display 15 lines of text above -- , div shrinks , shows me 1 line of new text:
1) hey ad links?
so other 14 lines not visible. i'm missing basic here?
maybe need add plus onto end of each line
"<br /><br /><b>1) hey ad links?</b><br /><br />" + "<br /><br /><b>2) hey ad links?</b><br /><br />" + "<br /><br /><b>1) hey ad links?</b><br /><br />" + "<br /><br /><b>2) hey ad links?</b><br /><br />"
that's reason can think of when it's adding 1 line.
note javascript use +
not php
if not problem need show output php of innerhtml
Comments
Post a Comment