Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Firefox4测试版更新后出现未定义错误_Javascript_Str Replace_Firefox4 - Fatal编程技术网

Javascript Firefox4测试版更新后出现未定义错误

Javascript Firefox4测试版更新后出现未定义错误,javascript,str-replace,firefox4,Javascript,Str Replace,Firefox4,谁能检查一下我的代码,告诉我哪里做错了。我的javascript非常差,在firefox从3.5版升级到4版测试版后,很长一段时间都在使用这段代码,我遇到了一个未定义的错误 function Convert_ONE2TWO() { var arrTWO = new Array( "a", "e", "i"); var arrONE = new Array( "A", "E", "I"); str=document.frmConvert.txtONE.value; //in

谁能检查一下我的代码,告诉我哪里做错了。我的javascript非常差,在firefox从3.5版升级到4版测试版后,很长一段时间都在使用这段代码,我遇到了一个未定义的错误

function Convert_ONE2TWO()
{
    var arrTWO = new Array( "a", "e", "i");
    var arrONE = new Array( "A", "E", "I");
    str=document.frmConvert.txtONE.value; //input from ONE
    for (i=0;i<3;i++) //Loop for all letters
        {
        strTemp=new RegExp(arrONE[i], "ig");
        str=str.replace(strTemp,arrTWO[i]); //Replacing
        }
    document.frmConvert.txtTWO.value=str.toString(); //output to TWO
}

<form name="frmConvert" action="" method="get">
<textarea rows="5" cols="90" name="txtONE"></textarea>
<input name="btnConvertg" value="Create TWO" onclick="Convert_ONE2TWO();" type="Button">
<textarea rows="5" cols="90" name="txtTWO"></textarea>
</form>
函数转换_ONE2TWO()
{
var arrTWO=新数组(“a”、“e”、“i”);
var arrONE=新数组(“A”、“E”、“I”);
str=document.frmConvert.txtONE.value;//从一个

对于(i=0;i您的循环是错误的。您有三个数组元素,但执行四次循环迭代


用于(变量i=0;i<3;i++)
记住,数组索引从
0
开始,而不是
1

不明白,该接受什么?你是否在测试版软件中测试了所有代码?@alex:它还标记了这个问题,并回答了社区的存档和组织利益。哦!我不知道!我在这里得到了很多帮助,尤其是特别是对于我的第一个问题,我现在将检查如何接受,并接受我喜欢的答案。不,即使我使用4而不是3,我也会遇到错误。在safari中,我也会遇到这个错误,但被忽略,因为我可以使用firefox进行工作,现在我必须面对这个问题。@user625118:更正您帖子代码中的这个基本错误,然后我们可以继续。