我必须在下面的js中添加几行。我想要做的是在URL“%cta%%”的末尾添加一个#id。有人能帮我吗?非常感谢!
thisthing.replaceData = function (thisTemplate, htmlList, htmlOverlayer, dataJs, indexLi) {
//thisTemplate = thisTemplate.replace('%%img%%', '/B2C/ResourcesWebRevise/booking/thisthing/custom/' + dataJs + '.jpg');
thisTemplate = thisTemplate.replace('%%title%%', thisthingData.title);
thisTemplate = thisTemplate.replace('%%desc%%', thisthingData.desc);
thisTemplate = thisTemplate.replace('%%cta%%', thisthingData.cta); // bridge cta
thisTemplate = thisTemplate.replace('%%list%%', htmlList);
thisTemplate = thisTemplate.replace('%%overlayer%%', htmlOverlayer);
thisthing.print(thisTemplate, dataJs, indexLi);
}发布于 2017-05-02 14:26:20
希望这就是你所需要的。只需使用+=添加到字符串的末尾即可。
thisthing.replaceData = function(thisTemplate, htmlList, htmlOverlayer, dataJs, indexLi) {
//thisTemplate = thisTemplate.replace('%%img%%', '/B2C/ResourcesWebRevise/booking/thisthing/custom/' + dataJs + '.jpg');
thisTemplate = thisTemplate.replace('%%title%%', thisthingData.title);
thisTemplate = thisTemplate.replace('%%desc%%', thisthingData.desc);
thisTemplate = thisTemplate.replace('%%cta%%', thisthingData.cta); // bridge cta
thisTemplate = thisTemplate.replace('%%list%%', htmlList);
thisTemplate = thisTemplate.replace('%%overlayer%%', htmlOverlayer);
thisTemplate += "#id"; // Pretty simple
thisthing.print(thisTemplate, dataJs, indexLi);
}https://stackoverflow.com/questions/43740364
复制相似问题