adjusting the height and width of innerHTML

Discussion in 'Javascript' started by newbie, May 16, 2007.

  1. newbie

    newbie Guest

    I am a newbie on javascript, and here is a question I'd like to ask.
    Thanks in advance for the help. Here you can see my point: right now,
    I can ask the div of 'list_comment' to be 250x200. But when
    'comments_display.php' is larger than 250x200, I really want a
    scrollable list_comment, so that I can scroll down the comment in the
    innerHTML.

    Thanks,

    <script>
    function TurnOnDiv(e, div_name) {
    theObject = document.getElementById(div_name);
    theObject.style.width = "250px";
    theObject.style.height = "200px";
    var posx, posy;
    if (!e) var e = window.event;
    if (e.pageX || e.pageY) {
    posx = e.pageX - 250;
    posy = e.pageY - 200;
    }
    else if (e.clientX || e.clientY) {
    posx = e.clientX + document.body.scrollLeft +
    document.documentElement.scrollLeft - 250;
    posy = e.clientY + document.body.scrollTop +
    document.documentElement.scrollTop - 200;
    }

    theObject.style.left = posx + "px";
    theObject.style.top = posy + "px";
    theObject.style.visibility = "visible";
    }

    function ProcessAjax(serverPage, objID) {
    xmlhttp = GetXmlHttpObject();
    var obj = document.getElementById(objID);
    xmlhttp.open("GET", serverPage);
    xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    obj.innerHTML = xmlhttp.responseText;
    }
    }
    xmlhttp.send(null);
    }


    </script>

    <div id="list_comment" style="visibility: hidden"> </div>

    <p style="font-size: 13px" > <a href="javascript://"
    onclick="TurnOnDiv(event, 'list_comment');
    ProcessAjax('comments_display.php', 'list_comment')">Read Comments
    >>></a></p>
    newbie, May 16, 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. Adam Smith

    Adjusting Input field size (height)

    Adam Smith, Sep 9, 2006, in forum: HTML
    Replies:
    3
    Views:
    12,893
    Jukka K. Korpela
    Sep 9, 2006
  2. Replies:
    2
    Views:
    1,612
    Ben C
    Apr 2, 2007
  3. Cal Who
    Replies:
    2
    Views:
    403
    Cal Who
    Jun 1, 2010
  4. Jesse Joseph Acosta

    Adjusting the width and height of a popup window

    Jesse Joseph Acosta, Nov 18, 2003, in forum: Javascript
    Replies:
    1
    Views:
    92
  5. Fredyy
    Replies:
    3
    Views:
    128
    Fredyy
    Jul 14, 2006
Loading...

Share This Page