View Full Version : word replacement in a paragraph

04-15-2005, 08:17 PM
I would like to build a page whose top part has about 4 text fields, and a button "convert".

The lower part of the same page has a paragraph of text which has 4 words in different places that needs to be replaced with whatever is filled in the above text fields, by clicking the "Convert" button.

I'd like to stay on the same page and this action to happen when I click the button.

Any help, how to achieve this?


04-15-2005, 10:00 PM
Any help, how to achieve this?With Javascript. Text nodes. String replace method. Easy.


04-15-2005, 10:35 PM
I read through all of it, but couldn't quite figure it out from the examples. Am new to javascript, and would appreciate if someone could through a sample code or something.

Guess I'm stuck to figure out how to have two paragraphs in continuation with different IDs. e.g.

<p align="center" id="testPara1">Hello</p>

<p align="center" id="testPara2">How are you</p>.

I want them to appear as: Hello. How are you. Rather than


How are you.

That way I can probably be able to change different words with in the same paragraph, using different Ids for the nodes.

Any help is appreciated.

04-18-2005, 04:13 PM
still looking for a lil help here.....

04-18-2005, 04:24 PM
You want to use spans and not paragraph tags. paragraph tags are meant to have a page break. spans will not have a page break.