topical media & game development
basic-web-html-12-ch12-eg04.htm / htm
<html>
<head><title>The replace() method</title></head>
<body>
<p>Replacing carriage returns and line feeds with a <br /> tag:</p>
<form name="myForm">
<textarea name="myTextArea" id="myTextArea" cols="40" rows="10">
Here is some text
the carriage returns and
line breaks should be replaced
with tags.</textarea><br /><br />
<input type="button" value="Replace breaks" onclick="document.myForm.myTextArea.value =document.myForm.myTextArea.value.replace(/\r\n|\r|\n/g, '<br />');">
</form>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.