PHP Classes

File: testscript.js

Recommend this page to a friend!
  Classes of Michael A. Peters   CSP Filter   testscript.js   Download  
File: testscript.js
Role: Auxiliary data
Content type: text/plain
Description: Example JS
Class: CSP Filter
Filter HTML based on Content Security Policy
Author: By
Last change:
Date: 15 years ago
Size: 847 bytes
 

Contents

Class file image Download
function parReplace() { var myPar = document.getElementById('scriptTest'); // delete all children if (myPar.hasChildNodes()) { while (myPar.childNodes.length >= 1) { myPar.removeChild(myPar.firstChild); } } // add new children var stringOne = document.createTextNode('This paragraph content was generated by JavaScript. If you were viewing the '); var anchorOne = document.createElement('a'); anchorOne.setAttribute('href','index.php'); var anchorText = document.createTextNode('index.php'); anchorOne.appendChild(anchorText); var stringTwo = document.createTextNode(' version of this page, the script would have been deleted from the page source and thus would not have executed.'); myPar.appendChild(stringOne); myPar.appendChild(anchorOne); myPar.appendChild(stringTwo); }