Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: PLease Help!


Message #1 by tgifn@n... on Sun, 19 May 2002 16:03:20 -0400 (EDT)
Listed below is a partial script. Can anyone explain how I can execute this
function with an alert() statement and it works perfectly. It does replace
the word Paul in myString with FRANK.

However, if I replace the   alert() statement with
form.result.value = myString  it gives me a javascript error and will not
replace in the TextArea field.

var myString = "Paul, Paula, Pauline, paul, Paul, JeanPaul";
var myRegExp = /\bPaul\b/g;

function errWrd1(form) {
        ab = "FRANK";
        document.myForm.nuword.value = ab;
        myString = myString.replace(myRegExp,ab);
        alert(myString);  // replace with --- form.result.value = myString:

}

<A HREF="javascript:errWrd1()" onClick= "return errWrd1">Read </A>
<TEXTAREA NAME = "result" COLS=60  ROWS=9 WRAP = "soft"></TEXTAREA>




  Return to Index