I wrote a custom script that places on the page from the database. The problem is that on the site I need, to which I do not have access, I placed the button by embedding the DOM tree

w.table = document.getElementById('cwc_Masthead').getElementsByTagName("TBODY")[0].getElementsByTagName("TR")[0]; tr = w.table.innerHTML; tr += "<td class=\"logout\"><a class=\"cwc-logoutButton\" href=\"#\" onclick=\"javascript: watchPC()\"><span>Нажми что бы увидеть</span></a></td>"; w.table.innerHTML = tr; 

and in the same script wrote some function

 function watchPC(){} 

When you click on the button, the console issues

 Uncaught ReferenceError: watchPC is not defined 

How do I get into a custom script to execute the necessary code?

  • well, the added watch function, and trying to watchPC - what other result would you expect? - Grundy
  • Sorry corrected typo question. The code is written correctly. - Michael

0