Read, convert to an array and rewrite the contents of a table cell.

Reads and rewrite the contents of a cell table. It sets the HTML contents of the cell to an array and then rewrites all the content except for the 1st and last 2 indexs of the arrays.
HTML • JavaScript


<script language="Javascript">
var sitename = document.getElementById("fbdata").innerHTML ;
var wordsarray = sitename.split("<BR>")
var newcode = '<p><font face="Verdana" color="808080" size="1"><span lang="en-us">'
for (i=1; i<(wordsarray.length)-2; i++){
	if (i==1){
		newcode = newcode + wordsarray[i];
	}else{
		newcode = newcode + '<br>' + wordsarray[i];
	}
}
newcode = newcode + '</span></font></p>'
document.getElementById("fbdata").innerHTML = newcode
</script>      


Posted by fbrefere001 on Saturday April 2, 2005