View Single Post
  #2 (permalink)  
Old June 17th, 2004, 10:50 AM
Walter G Walter G is offline
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi I kept searching and found an example that works at http://forums.devshed.com/archive/t-14600
I tested the example and it works just the way I wanted it to.

Walter.

Here is the code.

This works on IE5.5 and seems to work most of the time on NS 4.7 <html>
<head>
<title>Scroll textbox</title>
<script language=javascript>

function scrollTextarea()
{var obj=document.forms.main.elements.text;

var gradual=true; // true to scroll slowly, false to jump

obj.focus();

if (document.layers)
{obj.select();
obj.blur();
}
else if (gradual)
{var top=-1
while (top<obj.scrollTop)
{top=obj.scrollTop++;}
}
else
{obj.scrollTop=obj.scrollHeight-obj.offsetHeight;}
}

function fillTextarea()
{var htmlStr="";
for (var i=0;i<100;i++)
{htmlStr+="<h3>Line "+i+"</h3>\n"}
document.forms.main.elements.text.value=htmlStr;
}

</script>
</head>
<body bgcolor=black onload="fillTextarea();scrollTextarea();">
<basefont face=arial color=lime>
<h2>Scroll textbox</h2>
<form name=main action=# method=get>
<textarea name=text rows=10>
</textarea>
</form>
</body>
</html>Not sure how will get on in NS6, but NS6 won't lanuch at the moment to test!!
Referred to msdn (http://msdn.microsoft.com/workshop/c...s/textarea.asp) for dom

Ed.

Reply With Quote