Counting Line Breaks in htmlText

You could also do:

escape(t.text).indexOf("%0D");

To count the breaks, I would use the String.split method and use the length of the returned array minus 1:

escape(t.text).split("%0D").length - 1