Double-document.write('<scr'+'ipt>...) insert <br>-like space?

Discussion in 'Javascript' started by Richard, Aug 24, 2007.

  1. Richard

    Richard Guest

    <div id="right" >
    <script type="text/javascript">
    if (IsThis)
    document.write('<img src="images/foo.gif" />');
    else
    {
    document.write('<div id="too_right"><scr' + 'ipt type="text/
    javascript" src="http://external.com/script.js"></scr' + 'ipt></
    div>');
    }
    </script>
    </div>

    Now here's the good part: http://external.com/script.js returns (wait
    for it) 'document.write("<img src="..." />");'

    This actually works, except that it acts like I have put in <br/>
    elements. The <img> is top-aligned (good) but the image returned by
    the script.js is pushed to the bottom, AND (worse) the whole <div>
    height is increased, pushing all the later elements on the page down.

    Does the legacy of write() imply a newline at the end?

    If CSS is the answer, I would prefer not trying to position the
    "right" div; trying to restrain the height would be easier.
     
    Richard, Aug 24, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sydex
    Replies:
    12
    Views:
    6,508
    Victor Bazarov
    Feb 17, 2005
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,915
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    1,680
    Stephen Horne
    Oct 27, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    1,031
    Steve Lamb
    Oct 23, 2003
  5. Richard
    Replies:
    4
    Views:
    370
    Thomas 'PointedEars' Lahn
    Aug 25, 2007
Loading...

Share This Page