[thelist] Re: thelist digest, Vol 2 #1924 - 44 msgs

Syed Zeeshan Haider zeeshan_paki at yahoo.com
Mon Jan 21 09:42:51 CST 2002


Hi,
Thank you for taking time to reply.
In fact, I want to replace a part of a sentence with some other words and that sentence is stored in a variable. Look at the
following code:
<script language="JavaScript">
var sentence="John went to the historical city of Lahore for spending vacation."
// I want to change the value of variable "sentence" as in following line by using "replace" method.
sentence="John went to the beautiful city of Swat for spending vacation."
// I have replaced "historical city of Lahore" with "beautiful city of Swat" by simple means. I want to do the same with the help of
"replace" method.
</script>
I hope you can help.
Thank you,
Syed Zeeshan Haider.
http://syedzeeshanhaider.faithweb.com/

----- Original Message -----
Message: 17
Date: Sun, 20 Jan 2002 15:31:40 +0000
From: Andrew Clover <and at doxdesk.com>
To: thelist at lists.evolt.org
Subject: Re: [thelist] Use of "replace" method in JavaScript
Reply-To: thelist at lists.evolt.org

Syed Zeeshan Haider <zeeshan_paki at yahoo.com> wrote:

> Can somebody explain me the use of "replace" method in JavaScript

What object? Only 'replace' method I can think of is window.location.replace.
Moves to a new page without keeping the previous one in history - typically
used as a "poor man's redirect" by people without access to proper HTTP
redirects, and client-side browser-sniffing scripts. Support: Netscape 3+
and pretty much all other JavaScript browsers.

Oh, and there's String.replace, for regular expression-based string
manipulation. docs:

  http://developer.netscape.com/docs/manuals/js/client/jsref/string.htm#1194258

Support: Netscape 4+, IE4+, Mozilla, not Opera.

Were either of those the replace you were thinking of?

--
Andrew Clover
mailto:and at doxdesk.com
http://and.doxdesk.com/


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com






More information about the thelist mailing list