saroye
08-25-2003, 02:15 PM
New to JS - much ignorance still...
Trying to create an onclick funtion that will create a carriage return after each period (at the end of each sentence) for sentences typed into a textarea box.
Here's what I am currently working with:
<script type="text/javascript">
var period = '.';
function addCR() {
document.bob.test.value = document.bob.test.value + period + "\n";
}
function slf()
{
var string1=document.bob.test.value
if (string1.indexOf(".")==+1)
{
addCR()
}
}
</script>
</head>
<body>
<form name="bob">
<textarea name="test" rows="5" cols="20">Some text</textarea>
<input type="button" value="slf" onClick="slf()">
</form>
Any help most appreciated before I put the gun in my mouth...
Thanks.
Trying to create an onclick funtion that will create a carriage return after each period (at the end of each sentence) for sentences typed into a textarea box.
Here's what I am currently working with:
<script type="text/javascript">
var period = '.';
function addCR() {
document.bob.test.value = document.bob.test.value + period + "\n";
}
function slf()
{
var string1=document.bob.test.value
if (string1.indexOf(".")==+1)
{
addCR()
}
}
</script>
</head>
<body>
<form name="bob">
<textarea name="test" rows="5" cols="20">Some text</textarea>
<input type="button" value="slf" onClick="slf()">
</form>
Any help most appreciated before I put the gun in my mouth...
Thanks.