Click to See Complete Forum and Search --> : Replace


ollmorris
12-31-2002, 01:34 PM
I have the code:


function AddText(form, Action){
var AddTxt="";
var txt="";

if(Action==7){
var fonts=form.font.value;
var change=txt.replace(+fonts);
AddTxt=change;
}

form.Text1.value+=AddTxt;
}


However the CHANGE variable doesn't seem to work. Can anyone help me?

Thanks

spoontacular
12-31-2002, 01:37 PM
What is that supposed to do exactly?

ollmorris
12-31-2002, 01:49 PM
it is meant to add code to a textarea

spoontacular
12-31-2002, 01:54 PM
Try:

function addText(areaid, addtxt) {

var textarea = document.getElementById(areaid);
var areatxt = textarea.value;

areatxt = areatxt + addtxt;

textarea.value = areatxt;

}

(tested with IE6 and Mozilla 1.3a)