テキストエリアの文字列を置換する

以前もらったもの

javascript: var f, i, form; var a, b, n; n=0; a=prompt('Replace regexp...'); if (a != null) b=prompt('...with', a); if (a != null && b != null) { for (f=0; f<document.forms.length; f++) { form=document.forms[f]; for (i=0; i<form.length; i++) { if (form[i].type == 'textarea') { n++; form[i].undo = form[i].value; form[i].value = form[i].value.replace(new RegExp(a, 'g'), b); }; }; }; window.status='Replaced in '+n+' textareas'; }; document.url = document.url;

おお、今になってわかった document.forms[0]で最初のformだな。