错误JS1015 - 未终止的字符串常量

时间:2014-03-04 19:13:46

标签: javascript html parsing jscript

我正在Microsoft Orchestrator 2012上运行jscript,我一直收到此错误

活动\ RunScript \ w0vjlke0.0.js(8,14):错误JS1015:未终止的字符串常量

如果你能帮助我,我将非常感激,因为我似乎无法找出导致它的原因。

我想这将是一个橡皮鸭调试^ _ ^

        //Questions and answers will be ordered in two separated arrays
        var questions = new Array();
        var answers = new Array();
        //Your data
        var myData = '\`d.T.~Ed/{8DFD771C-13FA-40D4-84AE-8ECD056BCC2D}.UserInput\`d.T.~Ed/';
        //Regex goes here
        var regex=/\"(.*?)\"/g;
        var match = regex.exec(myData);
        var i = 1;
        var pos = 0;
        //Loop for all questions and answers, avoiding the type="string" attribute
while (match != null) {
    pos = i % 3;
    switch(pos){
        case 1: questions[questions.length] = match[1]; break;
        case 2: answers[answers.length] = match[1]; break;
    }
    i++;
    match = regex.exec(myData);
    }
    //Check all questions and answers are at their correct positions
    //Loop to grab all data and input the html fields to format into table
    var counter='';
    var objectnumber=(i-5);
    objectnumber = objectnumber/2;
    counter=0;
    var html1q='<tr><td>';
    var html2q='</td><td>';
    var html3q='</td></tr>';
    var realtext='';
    while (objectnumber != counter) {
       realtext += html1q + questions[counter] + html2q + answers[counter] + html3q;
        counter++;
    }
    output=realtext;

好的,谢谢你们!

1 个答案:

答案 0 :(得分:0)

可能缺少

周围的引号
var regex=/\"(.*?)\"/g;

...

我不会说jscript,但这看起来并不正确,它跳出了我......