Keep in mind that only 1 space is significant in HTML (i.e., multiple adjacent whitespace characters will be rendered as a single space).
If you are displaying what was entered in an HTML page and you want to preserve spaces, you can put the output in a <pre> ... </pre> block or you can convert the spaces to the entity.
Main Topics
Browse All Topics





by: mplungjanPosted on 2006-08-01 at 07:16:01ID: 17223976
It does not do anything like that...
;
Try it yourself...
<form>
14 spaces[<textarea name="t1"> </textarea>]
</form>
<script>
val = document.forms[0].t1.value
alert(val.length)
alert(escape(val)+' = '+(escape(val).length/3) + '*%20')
</script>