...

View Full Version : Dynamically adding && removing text



jefiux
08-09-2005, 01:23 AM
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:

<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>

glenngv
08-09-2005, 05:57 AM
don't flame on me,But first, follow the forum rules. :rolleyes:
Double-posting is against forum rules. You should have continued posting in the original thread (http://www.codingforums.com/showthread.php?t=65424) 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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum