How to replace part of href= value from a javascript variable similer to phps str_replace(..)?
<p>i got javascript variable(code2) that holds the following data:</p>

<pre><code>&lt;div class="pages"&gt;&lt;center&gt;&lt;a class="selected" href="/Episodes-1234_power1" title="power album page 1" &gt;1&lt;/a&gt;&lt;a class="normal" href="/Episodes-1234_power2" title="power album page 2"&gt; 2&lt;/a&gt;
</code></pre>

<p>and i want to change it to this:</p>

<pre><code>&lt;div class="pages"&gt;&lt;center&gt;&lt;a class="selected" href="./doit.php?title=&lt;?php echo $_GET['title'];?&gt;&amp;Num=/Episodes-1234_power1" title="power album page 1" &gt;1&lt;/a&gt;&lt;a class="normal" href="./doit.php?title=&lt;?php echo $_GET['title'];?&gt;&amp;Num=/Episodes-1234_power2" title="power album page 2"&gt; 2&lt;/a&gt;
</code></pre>

<p>I have doen similer thing in php like this example :</p>

<pre><code>$code2=str_replace('href="', 'href="./doit.php?title='.$title.'&amp;Num=', $code1);
echo $code2;
</code></pre>

<p>I tried to do same thing in javascript but my following code doesnt work! could you guys help me fix it? Thanks</p>

<pre><code>&lt;script&gt;
.....
.....
alert ('' + code2);

 //document.write(code2);
var myString = code2;
var myString2 = myString.replace(href=, 'href="./doit.php?title=&lt;?php echo $_GET['title'];?&gt;&amp;Num=');

document.write (myString2);
&lt;/script&gt;
</code></pre>
