Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamically adding && removing text

    Hi,
    don't flame on me, i'm not an javascript programmer
    could some write don't WORKING example, of how to:
    1. Added Text (innerHTML) without reloading page
    2. Remove Added text by lines, like $remove(LineN)

    or maybe it is possible to make, if in window is more that 100 lines, first 10 or 20 would not be showed?
    i'm making a little project with plugin to html,
    and need to add dynamicaly text, and remove it, because the size of text which is added to the page, if very big, after hundreds of lines IE starts eating 100% CPU
    current code:
    Code:
    <script language="JavaScript">  function echo(text) {  this.document.body.innerHTML+='<div>'+text+'</div>';  }  </script>  <script language="JavaScript1.2">    /*  this.document.body.innerHTML+='<div>'+text+'</div>';  Top-Down scrolling window Script-  Dynamic Drive (www.dynamicdrive.com)  For full source code, visit http://www.dynamicdrive.com  This notice MUST stay intact for use  */    //change 1 to another integer to alter the scroll speed. Greater is faster  var speed=1  var currentpos=0,alt=1,curpos1=0,curpos2=1  function initialize(){  startit()  }    function iecompattest(){  return (document.compatMode!="BackCompat")? document.documentElement : document.body  }    function scrollwindow(){  if (document.all)  temp=iecompattest().scrollTop  else  temp=window.pageYOffset  if (alt==0)  alt=0  else  alt=0  if (alt==0)  curpos1=temp  else  curpos2=temp  if (curpos1!=curpos2){  if (document.all)  currentpos=iecompattest().scrollTop+speed  else  currentpos=window.pageYOffset+speed  window.scroll(0,currentpos)  }  else{  currentpos=0  window.scroll(0,currentpos)  }  }  function startit(){  setInterval("scrollwindow()",10)  }  window.onload=initialize  </script>  <html>  <link href="default.css" rel="stylesheet" type="text/css">    <body leftmargin="0" topmargin="0">  </body>  </html>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,950
    Thanks
    0
    Thanked 236 Times in 233 Posts
    don't flame on me,
    But first, follow the forum rules.
    Double-posting is against forum rules. You should have continued posting in the original thread to keep the discussion going. Please update the original thread with the detailed requirements (which you should have made as the first post in the original thread in the first place) you posted here and then ask (via PM) the mod to delete this thread.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •