scrolling issue. pleeeezzzz help...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mel

    scrolling issue. pleeeezzzz help...

    i have the following code and need to scroll the div to the bottom on each
    of the inserts.

    please help *&^%$#@

    <a href=# onclick="addtex t('Wed Mar 23 11:23:58 AM Eastern Standard Time
    2005<BR>');">
    <b>HELLO</b>
    </a>
    <div id=MyDiv style=height:20 0;overflow:auto class=normal style="border:1 px
    CCCCCC solid">
    </div>
    <script>

    <!--- Hide script from browsers that don't understand JavaScript

    function addtext(string) {
    var c = new Date();
    oDiv = document.getEle mentById("MyDiv ");
    oDiv.innerHTML = oDiv.innerHTML + string;
    self.scroll(0, 50000);
    }

    addtext('111159 5039<BR>');
    addtext('111159 5040<BR>');
    addtext('111159 5041<BR>');
    addtext('111159 5042<BR>');
    addtext('111159 5043<BR>');
    addtext('111159 5044<BR>');
    addtext('111159 5045<BR>');
    addtext('111159 5046<BR>');
    addtext('111159 5047<BR>');
    addtext('111159 5048<BR>');
    addtext('111159 5049<BR>');
    addtext('111159 5050<BR>');
    addtext('111159 5051<BR>');
    addtext('111159 5052<BR>');
    addtext('111159 5053<BR>');
    addtext('111159 5054<BR>');
    // End hiding -->
    </script>


  • kaeli

    #2
    Re: scrolling issue. pleeeezzzz help...

    In article <42419a0e$1@use net01.boi.hp.co m>, mel.m.heravi@hp .com enlightened
    us with...[color=blue]
    > i have the following code and need to scroll the div to the bottom on each
    > of the inserts.
    >
    > please help *&^%$#@
    >[/color]

    Tested in MSIE6 and Firefox 1.0

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title> New Document </title>
    </head>

    <body>
    <a href=# onclick="addtex t('Wed Mar 23 11:23:58 AM Eastern Standard Time 2005
    <BR>');">
    <b>HELLO</b>
    </a>
    <div id="MyDiv" style="width:40 0px;height:100p x;overflow:scro ll;border:1px
    CCCCCC solid">
    </div>
    <script type="text/javascript">
    function addtext(string)
    {
    var c = new Date();
    oDiv = document.getEle mentById("MyDiv ");
    oDiv.innerHTML = oDiv.innerHTML + string;
    oDiv.scrollTop = oDiv.scrollHeig ht;
    }

    addtext('111159 5039<BR>');
    addtext('111159 5040<BR>');
    addtext('111159 5041<BR>');
    addtext('111159 5042<BR>');
    addtext('111159 5043<BR>');
    addtext('111159 5044<BR>');
    addtext('111159 5045<BR>');
    addtext('111159 5046<BR>');
    addtext('111159 5047<BR>');
    addtext('111159 5048<BR>');
    addtext('111159 5049<BR>');
    addtext('111159 5050<BR>');
    addtext('111159 5051<BR>');
    addtext('111159 5052<BR>');
    addtext('111159 5053<BR>');
    addtext('111159 5054<BR>');
    // End hiding -->
    </script>

    </body>
    </html>

    --
    --
    ~kaeli~
    A chicken crossing the road is poultry in motion.



    Comment

    • ExGuardianReader

      #3
      Re: scrolling issue. pleeeezzzz help...

      kaeli wrote:[color=blue]
      > In article <42419a0e$1@use net01.boi.hp.co m>, mel.m.heravi@hp .com enlightened
      > us with...
      >[color=green]
      >>i have the following code and need to scroll the div to the bottom on each
      >>of the inserts.
      >>
      >>please help *&^%$#@
      >>[/color]
      >
      >
      > Tested in MSIE6 and Firefox 1.0
      >
      > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      > "http://www.w3.org/TR/html4/loose.dtd">
      > <html>
      > <head>
      > <title> New Document </title>
      > </head>
      >
      > <body>
      > <a href=# onclick="addtex t('Wed Mar 23 11:23:58 AM Eastern Standard Time 2005
      > <BR>');">
      > <b>HELLO</b>
      > </a>
      > <div id="MyDiv" style="width:40 0px;height:100p x;overflow:scro ll;border:1px
      > CCCCCC solid">
      > </div>
      > <script type="text/javascript">
      > function addtext(string)
      > {
      > var c = new Date();
      > oDiv = document.getEle mentById("MyDiv ");
      > oDiv.innerHTML = oDiv.innerHTML + string;
      > oDiv.scrollTop = oDiv.scrollHeig ht;
      > }[/color]

      Now the challenge is to only scroll to the bottom if the div is already
      at the bottom when the new text is added.

      Ie, if the user has used the mouse to look back at the history, the div
      just grows without changing the scrolling position.

      A nice feature which I've tried in the past and never got exactly right!

      Comment

      • kaeli

        #4
        Re: scrolling issue. pleeeezzzz help...

        In article <d21b27$5vm$1@t itan.btinternet .com>, noway@noway.com enlightened
        us with...[color=blue]
        >
        > Now the challenge is to only scroll to the bottom if the div is already
        > at the bottom when the new text is added.
        >
        > Ie, if the user has used the mouse to look back at the history, the div
        > just grows without changing the scrolling position.
        >
        > A nice feature which I've tried in the past and never got exactly right!
        >
        >[/color]

        I think for that you'd have to use clipping, similar to the scroller in the
        link below, since you'd need to know the current position of things, when
        things were changed by the user, and where the bottom is (that's the most
        important part and I couldn't find a way to get whether something was at the
        bottom without using this method).
        More complicated, but quite possible.




        --
        --
        ~kaeli~
        If God dropped acid, would he see people?



        Comment

        Working...