Why string replace fails?

Giganews Newsgroups
Subject: Why string replace fails?
Posted by:  Don Li (tatata99…@gmail.com)
Date: Sun, 30 Mar 2008

Hi,

The blank.html reads:
<html><body bgcolor="#FFFFFF"></body></html>

// function
var str = new String();
str.replace('<html><body bgcolor="#FFFFFF"></body></
html>','<html><head><title></title></head><body
bgcolor=##FFFFFF><p>Hello 1</p></body></html>');
document.location = 'blank.html';

Thanks.

P.S.
If I use a new Object instead of String, but then we don't have the
{replace} method.

Replies