如何逃避撇号 [英] how to escape apostrophe

查看:92
本文介绍了如何逃避撇号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:


我遇到以下代码问题的鲸鱼。当以sugg开头的单词

包含转义的单引号(\''==>反斜杠

后跟引号)时,脚本会导致错误。如何保留

单引号。请查看以下代码并告知我们。很多

谢谢!


函数点击器(but_id,sugg0,sugg1,sugg2,sugg3,sugg4,sugg5,

copy_type, p1){

var suggx;

if(p1 == 1)suggx = sugg1;

else if(p1 == 2)suggx = sugg2;

else if(p1 == 3)suggx = sugg3;

else if(p1 == 4)suggx = sugg4;

else suggx = sugg5;


eval(" document.forms [0]。" + but_id +" .value =''" + suggx +

"''");


eval(" document.forms [0]。" + but_id +

" .style.backgroundColor =''#ffffff''");


eval(" document.forms [0]。" + but_id +

" .style.color =''#000000''");

// alert(in clicker);


var cont;

if(copy_type.indexOf(" HTML_COPY")> -1){

cont = document.forms [0] .HTML_COPY.value;

// alert(" conthtml =" + cont);

// alert(&qu) ot; sugg0 =" + sugg0);

var

txt =" document.forms [0] .HTML_COPY.value = cont.replace(/" + sugg0 +" /" +

replaceOpts +",''" + suggx +"'')" ;;

eval(txt);

// alert(document.forms [0] .HTML_COPY.value);

} else {

cont = document.forms [0] .AOL_COPY.value;

// alert(" contaol =" + cont );

// alert(" sugg0 =" + sugg0 +" suggx =" + suggx +"

replaceOpts =" + replaceOpts);

var

txt =" document.forms [0] .AOL_COPY.value = cont.replace(/" + sugg0 +" /" +

replaceOpts +",''" + suggx +"'')" ;;

eval(txt);

// alert (document.forms [0] .AOL_COPY.value);

// alert(document.forms [0] .AOL_COPY.value);

}

返回true;

}

函数showSugg(but_id,sugg0,sugg1,sugg2,sugg3,sugg4,sugg5,

copy_type ){


if(sugg0.indexOf("''")> -1)sugg0 = replaceAll(sugg0,"''",

" \''");

if(sugg1.indexOf("''")> -1)sugg1 = replaceAll(sugg1,"''",

" \''");

if(sugg2.indexOf(") ''")> -1)sugg2 = replaceAll(sugg2,"''",

" \''");

if (sugg3.indexOf("''")> -1)sugg3 = replaceAll(sugg3,"''",

" \''");

if(sugg4.indexOf("''")> -1)sugg4 = replaceAll(sugg4,"''",

" \' '");

if(sugg5.indexOf("''")> -1)sugg5 = replaceAll(sugg5,"''",

" \''");


display = window.open('''''''_ blank'',''menubar = 0,locatio n = no,status = no,directories = no,toolbar = no,scrollbar s = no,height = 220,width = 250'')

var screen_height = window.screen.availHeight;

var screen_width = window.screen.availWidth;

var left_point = parseInt(screen_width / 2);

var top_point = parseInt(screen_height / 2);

display.moveTo(left_point,top_point);

display.focus();


// alert(" display elements" + display.document.elements);

alert(" sugg1" + sugg1 +" 2" + sugg2 +" 3" + sugg3 +" 4" +

sugg4 +" 5" + sugg5);


if(sugg1)

var message ="< HTML>< BODY>< ; font face =''verdana,arial,

helvetica,san-serif''size =''2''>< form>< table>" ;;

message + ="< tr>< td>" + sugg1 +"< / td> < td>< input

type = checkbox name = mycheck1 value = \"" + sugg1 +

" \" onClick = \''self.opener.clicker(\"" + but_id +" \",\"" +

sugg0 +" \" ;,\""

+ sugg1 +" \",\"" + sugg2 +" \",\"" + sugg3 +" \",\"" + sugg4

+" \",\"" + sugg5 +

" ; \",\"" + copy_type +" \",1);"

+" document.forms [0] .mycheck2.checked = false ;"

+

" document.forms [0] .mycheck3.checked = false; document.forms [0] .mycheck4.checked = false;"

+" document.forms [0] .mycheck5.checked = false;"

+" \''>< / td>< / tr>" ;;

if(sugg2)

message + ="< tr>< td>" + sugg2 + < / td>< td>< input type = checkbox

name = mycheck2 value = \"" + sugg2 +

" \" onClick = \''self.opener.clicker(\"" + but_id +" \",\"" +

sugg0 +" \" ;,\""

+ sugg1 +" \",\"" + sugg2 +" \",\"" + sugg3 +" \",\"" + sugg4

+" \",\"" + sugg5 +

" ; \",\"" + copy_type +" \",2);"

+" document.forms [0] .mycheck1.checked = false ;"

+

" document.forms [0] .mycheck3.checked = false; document.forms [0] .mycheck4.checked = false;"

+" document.forms [0] .mycheck5.checked = false;"

+" \''>< / td>< / tr>" ;;


if(sugg3)

message + ="< tr>< td>" + sugg3 + < / td>< td>< input type = checkbox

name = mycheck3 value = \"" + sugg3 +

" \" onClick = \''self.opener.clicker(\"" + but_id +" \",\"" +

sugg0 +" \" ;,\""

+ sugg1 +" \",\"" + sugg2 +" \",\"" + sugg3 +" \",\"" + sugg4 +

" \",\"" + sugg5 +

" ; \",\"" + copy_type +" \",3);"

+" document.forms [0] .mycheck2.checked = false ;"

+

" document.forms [0] .mycheck1.checked = false; document.forms [0] .mycheck4.checked = false;"

+" document.forms [0] .mycheck5.checked = false;"

+" \''>< / td>< / tr>" ;;


if(sugg4)

message + ="< tr>< td>" + sugg4 + < / td>< td>< input

type = checkbox name = mycheck4 value = \"" + sugg4 +

" \" onClick = \''self.opener.clicker(\"" + but_id +" \",\"" +

sugg0 +" \" ;,\""

+ sugg1 +" \",\"" + sugg2 +" \",\"" + sugg3 +" \",\"" + sugg4 +

" \",\"" + sugg5 +

" ; \",\"" + copy_type +" \",4);"

+" document.forms [0] .mycheck2.checked = false ;"

+

" document.forms [0] .mycheck3.checked = false; document.forms [0] .mycheck1.checked = false;"

+" document.forms [0] .mycheck5.checked = false;"

+" \''>< / td>< / tr>" ;;


if(sugg5)

message + ="< tr>< td>" + sugg5 + < / td>< td>< input

type = checkbox name = mycheck5 value = \"" + sugg5 +

" \" onClick = \''self.opener.clicker(\"" + but_id +" \",\"" +

sugg0 +" \" ;,\""

+ sugg1 +" \",\"" + sugg2 +" \",\"" + sugg3 +" \",\"" + sugg4

+" \",\"" + sugg5

+" ; \",\"" + copy_type +" \",5);"

+" document.forms [0] .mycheck2.checked = false ;"

+

" document.forms [0] .mycheck3.checked = false; document.forms [0] .mycheck4.checked = false;"

+" document.forms [0] .mycheck1.checked = false;"

+" \''>< / td>< / tr>" ;;


message + ="< tr>< td> < input type = \" button \" class = \" btn \"

name = \" Replace\" value = \"替换\"

onclick = \" self.opener.replaceOpts = \''i \''\">< / td> ;" ;;

message + ="< td> < input type = \" button \" class = \" btn \"

name = \" Replace All\" value = \"替换所有\"

onclick = \" self.opener.replaceOpts = \''ig \''\'">< / td>" ;;

message + ="< td> < input type = \" button \" class = \" btn \"

name = \" Done \" value = \" Done \"

onclick = \" self.opener.display.close()\">< / td>< / tr> " ;;

留言+ ="< / table>< / font>" ;;

提醒(留言);


display.document.open();

display.document.write(message +"< / BODY>< / HTML>");

display.document.close();


}

Hello All:

I''m having a whale of a problem with the following code. When the words
beginning with sugg contain an escaped single-quote (\'' ==> back-slash
followed by quote) the script causes an error. How can I preserve the
single quote. Please review the code below and let me know. Many
thanks!

function clicker( but_id, sugg0, sugg1, sugg2, sugg3, sugg4, sugg5,
copy_type, p1) {
var suggx;
if (p1 ==1) suggx=sugg1;
else if (p1 ==2) suggx=sugg2;
else if (p1 ==3) suggx=sugg3;
else if (p1==4) suggx=sugg4;
else suggx=sugg5;

eval("document.forms[0]." + but_id + ".value=''" + suggx +
"''");

eval("document.forms[0]." + but_id +
".style.backgroundColor=''#ffffff''");

eval("document.forms[0]." + but_id +
".style.color=''#000000''");
//alert("in clicker");

var cont;
if (copy_type.indexOf("HTML_COPY") > -1) {
cont =document.forms[0].HTML_COPY.value;
//alert("conthtml=" + cont);
//alert("sugg0=" + sugg0);
var
txt="document.forms[0].HTML_COPY.value=cont.replace(/" + sugg0 + "/" +
replaceOpts + ",''" + suggx + "'')";
eval(txt);
//alert( document.forms[0].HTML_COPY.value);
} else {
cont =document.forms[0].AOL_COPY.value;
//alert("contaol=" + cont);
//alert("sugg0=" + sugg0 + " suggx= " + suggx + "
replaceOpts=" + replaceOpts);
var
txt="document.forms[0].AOL_COPY.value=cont.replace(/" + sugg0 + "/" +
replaceOpts + ",''" + suggx + "'')";
eval(txt);
//alert( document.forms[0].AOL_COPY.value);
//alert( document.forms[0].AOL_COPY.value);
}
return true;
}
function showSugg(but_id, sugg0, sugg1, sugg2, sugg3, sugg4, sugg5,
copy_type) {

if (sugg0.indexOf("''") > -1) sugg0=replaceAll(sugg0, "''",
"\''");
if (sugg1.indexOf("''") > -1) sugg1=replaceAll(sugg1, "''",
"\''");
if (sugg2.indexOf("''") > -1) sugg2=replaceAll(sugg2, "''",
"\''");
if (sugg3.indexOf("''") > -1) sugg3=replaceAll(sugg3, "''",
"\''");
if (sugg4.indexOf("''") > -1) sugg4=replaceAll(sugg4, "''",
"\''");
if (sugg5.indexOf("''") > -1) sugg5=replaceAll(sugg5, "''",
"\''");

display=window.open('''',''_blank'',''menubar=0,locatio n=no,status=no,directories=no,toolbar=no,scrollbar s=no,height=220,width=250'')
var screen_height = window.screen.availHeight;
var screen_width = window.screen.availWidth;
var left_point = parseInt(screen_width / 2);
var top_point = parseInt(screen_height/2);
display.moveTo(left_point, top_point);
display.focus();

//alert("display elements" + display.document.elements);
alert("sugg1" + sugg1 + "2" + sugg2 + "3" + sugg3 + "4" +
sugg4 + "5" + sugg5);

if (sugg1)
var message="<HTML><BODY><font face=''verdana, arial,
helvetica, san-serif'' size=''2''><form><table>";
message += "<tr><td>" + sugg1 + "</td> <td><input
type=checkbox name=mycheck1 value=\"" + sugg1 +
"\" onClick=\''self.opener.clicker(\"" + but_id + "\",\"" +
sugg0 + "\",\""
+ sugg1 + "\",\"" + sugg2 + "\",\"" + sugg3 + "\",\"" + sugg4
+ "\",\"" + sugg5 +
"\",\"" + copy_type + "\", 1);"
+ "document.forms[0].mycheck2.checked=false;"
+
"document.forms[0].mycheck3.checked=false;document.forms[0].mycheck4.checked=false;"
+ "document.forms[0].mycheck5.checked=false;"
+ "\''></td></tr>";
if (sugg2)
message += "<tr><td>" +sugg2 + " </td><td><input type=checkbox
name=mycheck2 value=\"" + sugg2 +
"\" onClick=\''self.opener.clicker(\"" + but_id + "\",\"" +
sugg0 + "\",\""
+ sugg1 + "\",\"" + sugg2 + "\",\"" + sugg3 + "\",\"" + sugg4
+ "\",\"" + sugg5 +
"\",\"" + copy_type + "\", 2);"
+ "document.forms[0].mycheck1.checked=false;"
+
"document.forms[0].mycheck3.checked=false;document.forms[0].mycheck4.checked=false;"
+ "document.forms[0].mycheck5.checked=false;"
+ "\''></td></tr>";

if (sugg3)
message += "<tr><td>" +sugg3 + " </td><td><input type=checkbox
name=mycheck3 value=\"" + sugg3 +
"\" onClick=\''self.opener.clicker(\"" + but_id + "\",\"" +
sugg0 + "\",\""
+ sugg1 + "\",\""+ sugg2 + "\",\"" + sugg3 + "\",\"" + sugg4 +
"\",\"" + sugg5 +
"\",\"" + copy_type + "\", 3);"
+ "document.forms[0].mycheck2.checked=false;"
+
"document.forms[0].mycheck1.checked=false;document.forms[0].mycheck4.checked=false;"
+ "document.forms[0].mycheck5.checked=false;"
+ "\''></td></tr>";

if (sugg4)
message += "<tr><td>" +sugg4 + " </td><td><input
type=checkbox name=mycheck4 value=\"" + sugg4 +
"\" onClick=\''self.opener.clicker(\"" + but_id + "\",\""+
sugg0 + "\",\""
+ sugg1 + "\",\""+ sugg2 + "\",\"" + sugg3 + "\",\"" + sugg4 +
"\",\"" + sugg5 +
"\",\"" + copy_type + "\", 4);"
+ "document.forms[0].mycheck2.checked=false;"
+
"document.forms[0].mycheck3.checked=false;document.forms[0].mycheck1.checked=false;"
+ "document.forms[0].mycheck5.checked=false;"
+ "\''></td></tr>";

if (sugg5)
message += "<tr><td>" +sugg5 + " </td><td><input
type=checkbox name=mycheck5 value=\"" + sugg5 +
"\" onClick=\''self.opener.clicker(\"" + but_id + "\",\"" +
sugg0 + "\",\""
+ sugg1 + "\",\"" + sugg2 + "\",\"" + sugg3 + "\",\"" + sugg4
+ "\",\"" + sugg5
+ "\",\"" + copy_type + "\", 5);"
+ "document.forms[0].mycheck2.checked=false;"
+
"document.forms[0].mycheck3.checked=false;document.forms[0].mycheck4.checked=false;"
+ "document.forms[0].mycheck1.checked=false;"
+ "\''></td></tr>";

message += "<tr><td> <input type=\"button\" class=\"btn\"
name=\"Replace\" value=\"Replace\"
onclick=\"self.opener.replaceOpts=\''i\''\"></td>";
message += "<td> <input type=\"button\" class=\"btn\"
name=\"Replace All\" value=\"Replace All\"
onclick=\"self.opener.replaceOpts=\''ig\''\"></td>";
message += "<td> <input type=\"button\" class=\"btn\"
name=\"Done\" value=\"Done\"
onclick=\"self.opener.display.close()\"></td></tr>";
message += "</table></font>";
alert(message);

display.document.open();
display.document.write(message + "</BODY></HTML>");
display.document.close();

}

推荐答案

上写道2005年7月11日在comp.lang.javascript
wrote on 11 jul 2005 in comp.lang.javascript:
eval(" document.forms [0]。" + but_id +" .value = ''" + suggx +
"''");


eval是邪恶的!


尝试:


document.forms [0] [but_id] .value = suggx


============== ===============

var suggx;
if(p1 == 1)suggx = sugg1;
if if(p1 = = 2)suggx = sugg2;
如果(p1 == 3)suggx = sugg3;
如果(p1 == 4)suggx = sugg4;
其他suggx = sugg5;
eval("document.forms[0]." + but_id + ".value=''" + suggx +
"''");

eval is evil!

Try:

document.forms[0][but_id].value = suggx

=============================
var suggx;
if (p1 ==1) suggx=sugg1;
else if (p1 ==2) suggx=sugg2;
else if (p1 ==3) suggx=sugg3;
else if (p1==4) suggx=sugg4;
else suggx=sugg5;




a变异,使用长列表更容易:


var suggAr = [0,sugg1,sugg2,sugg3,sugg4]

var suggx = sugg5;

if(p1< ; 5&& p1> 0)suggx = suggAr [p1];


未经测试


-

Evertjan。

荷兰。

(用我的电子邮件地址替换所有带点的十字架)



a variation, easier with long lists:

var suggAr = [0, sugg1, sugg2, sugg3, sugg4]
var suggx=sugg5;
if (p1<5 && p1>0) suggx=suggAr[p1];

Not tested

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


所以*********** @ yahoo.com 写道:
大家好:

我遇到以下代码的问题鲸鱼。当以sugg开头的单词包含转义的单引号(\''==>反斜杠
后跟引号)时,脚本会导致错误。我怎样才能保留
单引号。请查看以下代码并告知我们。很多
谢谢!

功能点击器(but_id,sugg0,sugg1,sugg2,sugg3,sugg4,sugg5,
copy_type,p1){
var suggx;
if(p1 == 1)suggx = sugg1;
如果(p1 == 2)suggx = sugg2;
如果(p1 == 3)suggx = sugg3;
else if(p1 == 4)suggx = sugg4;
其他suggx = sugg5;

eval(" document.forms [0]。" + but_id +" .value =' '" + suggx +
"''");


你期望用这个eval做什么?


确实

document.forms [0] [ but_id] .value = suggx;



document.forms [0] .elements [but_id] .value = suggx;



document.forms [0] .but_id.value = suggx;

不起作用?

eval(" document.forms [0]。 " + but_id +
" .style.backgroundColor =''#ffffff''");


document.forms [0] .but_id.style.backgroundColor =''#fffff''
eval(" document.forms [0]。" + but_id +
" .style.color =''#000000''");
// alert(in clicker);

var cont;
if(copy_type.indexOf(" HTML_COPY")> -1){
cont = document.forms [0] .HTML_COPY.value;
// alert(" conthtml =" + cont);
// alert(" sugg0 =" + sugg0);
var
txt =" document.forms [0] .HTML_COPY.value = cont.replace( /" + sugg0 +" /" +
replaceOpts +",''" + suggx +"'')" ;;
eval(txt);
Hello All:

I''m having a whale of a problem with the following code. When the words
beginning with sugg contain an escaped single-quote (\'' ==> back-slash
followed by quote) the script causes an error. How can I preserve the
single quote. Please review the code below and let me know. Many
thanks!

function clicker( but_id, sugg0, sugg1, sugg2, sugg3, sugg4, sugg5,
copy_type, p1) {
var suggx;
if (p1 ==1) suggx=sugg1;
else if (p1 ==2) suggx=sugg2;
else if (p1 ==3) suggx=sugg3;
else if (p1==4) suggx=sugg4;
else suggx=sugg5;

eval("document.forms[0]." + but_id + ".value=''" + suggx +
"''");
What do you expect to do with this eval ?

Did
document.forms[0][but_id].value = suggx;
or
document.forms[0].elements[but_id].value = suggx;
or
document.forms[0].but_id.value = suggx;
not work ?
eval("document.forms[0]." + but_id +
".style.backgroundColor=''#ffffff''");
document.forms[0].but_id.style.backgroundColor=''#ffffff''
eval("document.forms[0]." + but_id +
".style.color=''#000000''");
//alert("in clicker");

var cont;
if (copy_type.indexOf("HTML_COPY") > -1) {
cont =document.forms[0].HTML_COPY.value;
//alert("conthtml=" + cont);
//alert("sugg0=" + sugg0);
var
txt="document.forms[0].HTML_COPY.value=cont.replace(/" + sugg0 + "/" +
replaceOpts + ",''" + suggx + "'')";
eval(txt);




来自何处replaceOpts ?


txt = document.forms [0] .HTML_COPY.value = cont.replace(sugg0 / replaceOpts,suggx);

或不使用'' cont'':

with(document.forms [0] .HTML_COPY){txt = value = value.replace(sugg0 / replaceOpts,suggx);}


或许就是

with(document.forms [0] .HTML_COPY){

txt = value = value.replace(sugg0 +''/ replaceOpts'', suggx);

}

你想做什么?

-

Stephane Moriaux et son [moins ] vieux Mac



from where comes "replaceOpts" ?

txt=document.forms[0].HTML_COPY.value=cont.replace(sugg0/replaceOpts,suggx);
or without using ''cont'' :
with(document.forms[0].HTML_COPY){txt=value=value.replace(sugg0/replaceOpts,suggx);}

perhaps is it that
with(document.forms[0].HTML_COPY) {
txt = value = value.replace(sugg0+''/replaceOpts'',suggx);
}
what you want to do ?
--
Stephane Moriaux et son [moins] vieux Mac


ASM写道:
所以*********** @ yahoo.com 写道:
大家好:

我有以下代码的问题的鲸鱼。当以sugg开头的单词包含转义的单引号(\''==>反斜杠
后跟引号)时,脚本会导致错误。我怎样才能保留
单引号。请查看以下代码并告知我们。很多
谢谢!

功能点击器(but_id,sugg0,sugg1,sugg2,sugg3,sugg4,sugg5,
copy_type,p1){
var suggx;
if(p1 == 1)suggx = sugg1;
如果(p1 == 2)suggx = sugg2;
如果(p1 == 3)suggx = sugg3;
else if(p1 == 4)suggx = sugg4;
其他suggx = sugg5;

eval(" document.forms [0]。" + but_id +" .value =' '" + suggx +
"''");
你期望用这个eval做什么?

是否
document.forms [0 ] [but_id] .value = suggx;

document.forms [0] .elements [but_id] .value = suggx;

document.forms [0]。 but_id.value = suggx;
不起作用?
Hello All:

I''m having a whale of a problem with the following code. When the words
beginning with sugg contain an escaped single-quote (\'' ==> back-slash
followed by quote) the script causes an error. How can I preserve the
single quote. Please review the code below and let me know. Many
thanks!

function clicker( but_id, sugg0, sugg1, sugg2, sugg3, sugg4, sugg5,
copy_type, p1) {
var suggx;
if (p1 ==1) suggx=sugg1;
else if (p1 ==2) suggx=sugg2;
else if (p1 ==3) suggx=sugg3;
else if (p1==4) suggx=sugg4;
else suggx=sugg5;

eval("document.forms[0]." + but_id + ".value=''" + suggx +
"''");
What do you expect to do with this eval ?

Did
document.forms[0][but_id].value = suggx;
or
document.forms[0].elements[but_id].value = suggx;
or
document.forms[0].but_id.value = suggx;
not work ?




这是最后一个。评估工作正常。我尝试使用字符串AQUOTE替换sugg变量中的单个

引号。它的工作原理

罚款。我使用单引号的那一刻,虽然逃脱了,但代码中断了






It is the last one. The eval works fine. I tried substituting single
quotes in the sugg variables with the string "AQUOTE" and it works
fine. The moment I use single quotes, albeit escaped, the code breaks
down.


eval(" document.forms [0]。+ but_id +
.style.backgroundColor =''#ffffff''");
document.forms [0] .but_id.style.backgroundColor =''# ffffff''
eval("document.forms[0]." + but_id +
".style.backgroundColor=''#ffffff''");
document.forms[0].but_id.style.backgroundColor=''#ffffff''

eval(" document.forms [0]。" + but_id +
" .style.color =''#000000''" );
//警告(点击者);

var cont;
if(copy_type.indexOf(" HTML_COPY")> -1){
cont = document.forms [0] .HTML_COPY.value;
// alert(" conthtml =" + cont);
// alert(" sugg0 =" + sugg0 );
var
txt =" document.forms [0] .HTML_COPY.value = cont.replace(/" + sugg0 +" /" +
replaceOpts +" ,''" + suggx +"'')& ;;
eval(txt);

eval("document.forms[0]." + but_id +
".style.color=''#000000''");
//alert("in clicker");

var cont;
if (copy_type.indexOf("HTML_COPY") > -1) {
cont =document.forms[0].HTML_COPY.value;
//alert("conthtml=" + cont);
//alert("sugg0=" + sugg0);
var
txt="document.forms[0].HTML_COPY.value=cont.replace(/" + sugg0 + "/" +
replaceOpts + ",''" + suggx + "'')";
eval(txt);



来自何处replaceOpts ?



from where comes "replaceOpts" ?




replaceOpts是全球性的。还有replaceAll是简单的帮助函数


函数replaceAll(str,from,to){

var idx = str.indexOf(from);

while(idx> -1){

str = str.replace(from,to);

idx = str.indexOf(from);

}

返回str;


} txt = document.forms [0] .HTML_COPY.value = cont.replace(sugg0) / replaceOpts,suggx);
或不使用''cont'':
with(document.forms [0] .HTML_COPY){txt = value = value.replace(sugg0 / replaceOpts,suggx);


可能是(document.forms [0] .HTML_COPY){
txt = value = value.replace(sugg0 +''/ replaceOpts'',suggx );
}
你想做什么?



replaceOpts is a global. Also replaceAll is simple helper function

function replaceAll( str, from, to ) {
var idx = str.indexOf( from );
while ( idx > -1 ) {
str = str.replace( from, to );
idx = str.indexOf( from );
}
return str;

} txt=document.forms[0].HTML_COPY.value=cont.replace(sugg0/replaceOpts,suggx);
or without using ''cont'' :
with(document.forms[0].HTML_COPY){txt=value=value.replace(sugg0/replaceOpts,suggx);}

perhaps is it that
with(document.forms[0].HTML_COPY) {
txt = value = value.replace(sugg0+''/replaceOpts'',suggx);
}
what you want to do ?




感谢您解析我的代码。但是我仍然没有问题。



Thanks for dissecting my code. I however am still left with the problem.


这篇关于如何逃避撇号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆