Button Question

P

Papajo

Enter several words with spaces in between, tab out of the form box and
a paragraph break "<p>" is added to the spaces, it uses an onBlur to
fire the function, I would like to use the button instead, I haven't had
any luck. Any help is appreciated, Joe

http://web2jo.com/Work/A_Replac.html
 
R

RobG

Papajo said:
Enter several words with spaces in between, tab out of the form box and
a paragraph break "<p>" is added to the spaces, it uses an onBlur to
fire the function, I would like to use the button instead, I haven't had
any luck. Any help is appreciated, Joe

http://web2jo.com/Work/A_Replac.html


<script type="text/javascript">

function convertSpaces(str)
{
return str.replace(/\s+/g,'<p>');
}

</script>
 
P

Papajo

You simplified the script but it still won't work with the button, only
the onBlur. Joe
 
T

Thomas 'PointedEars' Lahn

Papajo said:
You simplified the script but it still won't work with the button, only
the onBlur.

It works only if you know what you do.


PointedEars
 
R

RobG

Papajo said:
You simplified the script but it still won't work with the button, only
the onBlur. Joe

You should reply below a trimmed quote of whatever you are replying to...


<form name="a">
<input name="b" type=text size=15>
<input type=button value="Go"
onclick="this.form.b.value=convertSpaces(this.form.b.value);">
</form>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,274
Latest member
JessMcMast

Latest Threads

Top