cancel
Showing results for 
Search instead for 
Did you mean: 

inserting javascript throws error

ThomasTong
Level 4
I have this javascript code that runs fine in the Developer Tools' Console in IE.  But when I try to insert that javascript into BP, it throws an error: Failed to perform step 1 in Navigate Stage 'Embed' on page 'Check Message Area' - More than one element matched the query terms Also, BP sometimes does insert this js code, but when I invoke it, it gives the same error at that time. Any ideas? Code: //helper function function  initBridge() {   if (document.getElementById("JSOutput") == null){       // Add invisible textbox       var body = document.getElementsByTagName("body")[0];       var text = document.createElement("input");       text.id = "JSOutput";       text.style.display = "none";       body.insertBefore(text, body.firstChild);   }   else  {       // Clear invisible textbox       document.getElementById("JSOutput").value = "";   } } // main function function getErrors(args) {  var i = 1;  var j = 0;  var errors = "";  var frameId= "CRMApplicationFrame";  //var topAreaId = "FRAME_TOPAREA";  var subFrameId = "FRAME_APPLICATION";  var formId = "myFormId";   // this section drills down into the webpage to extract the right elements from nested iframes  var mainFrame = document.getElementById(frameId);  var div2 = mainFrame.contentWindow.document.getElementById("APP_FRAME_ANCHOR"); mainFrame = div2.querySelector("iframe"); mainFrame = mainFrame.contentWindow.document.getElementById(frameId); var subFrame = mainFrame.contentWindow.document.getElementById(subFrameId); var frameset = subFrame.contentWindow.document.frames['WorkAreaFrame1']; var form = frameset.document.getElementById(formId);  //main work loop while(true) {   var divId= "CRMMessageLine" + i;   var div = form.querySelector("#" + divId);      if (!div) {    break;              }   var img = div.querySelector('.th-mes-line-img');   var alt = img.getAttribute("alt");   if (alt == 'Error') {    if (j)     errors += ", ";        var data = div.querySelector('.th-mes-line[title]');    if (data) {     var title = data.getAttribute("title");     errors += title;     j++;    }   }   i++;  }   initBridge();  if (j) {   document.getElementById("JSOutput").value= errors;  }  else {   var output = document.getElementById("JSOutput");   output.value= "No errors found";  } }
0 REPLIES 0