Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Javascript: find & replace text

Jun 30, 2005 8:25PM PDT

Is there any Javascript I can use to find and replace text on my site?

For instance, I want to replace "straight quotes" with “smart quotes”, and don't want to do so manually. I'm looking for a script that can find it on the Web page and replace it so that the user sees smart quotes.

Thanks in advance.

Discussion is locked

- Collapse -
Re: Javascript
Jul 1, 2005 7:59AM PDT

Basically I know nothing about Javascript but I know one site that might be useful to you here's the url http://www.hotscripts.com/

- Collapse -
Re: find & replace text with Javascript
Jul 4, 2005 12:29AM PDT

I'm sure the last individual's post was
helpful (not).
Unfortunately, mine may not be so helpful, either.
Javascript is something I'm still grasping in
it's fullness (and simplicity). It's power is in
it's use of other programming/server-side scripting
languages, and active-x control access, etc.
I'm fairly certain that it is incapable itself of
-finding- strings within the HTML code for you.
It is too simple a language.
However, it may be possible to keep track of individual
strings if they are given identifiers - this includes field entry strings made by a user. My impression was that this wasn't what you wanted, though.

- Collapse -
PHP can do it
Jul 28, 2005 8:44AM PDT

Not a javascript person, but I know PHP can do it relatively easily.