...

View Full Version : not sure but editing and replacing text



jeromepelletier
05-26-2006, 10:48 PM
I have a DIV field set up, is it posssible to put text in there, then later on, retrive the DIV, add a couple lines on top of the code
IE:


old
old
old

to

new
new
old
old
old

and, say if there is more then 10 lines, delete anything after that (guess itd check for <br>s ?)

THanks if you know :)..and post it :P

vwphillips
05-27-2006, 05:04 PM
divobj.innerHTML='New String'+divobj.innerHTML;

jeromepelletier
05-27-2006, 05:25 PM
divobj.innerHTML='New String'+divobj.innerHTML;

i had that already..its the deleting part i dont have (making it so only say 10 lines show)

vwphillips
05-27-2006, 07:09 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
</head>

<body>
<div id="fred" >
0<BR>
1<BR>
2<BR>
3<BR>
4<BR>
5<BR>
6<BR>
7<BR>
8<BR>
9<BR>
10<BR>
11<BR>
12<BR>
13<BR>
14<BR>
15<BR>
16<BR>
17<BR>
18<BR>
19<BR>
</div>


<script language="JavaScript" type="text/javascript">
<!--
var obj=document.getElementById('fred');
var string=obj.innerHTML.split('<BR>');
string.length=10;
obj.innerHTML=string.join('<BR>');
//-->
</script>

</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum