Your name: submit What is this?
Your last name: submit What is this?
document.getElementById("submit").addEventListener('click', function(){ walk(document.body, /\by\/n\b|\(y\/n\)/ig, document.getElementById("inputTxt").value); }); document.getElementById("submit2").addEventListener('click', function(){ var s = escapeRegExp('Y/L/N'); var val = new RegExp(s, "ig"); walk(document.body, val, document.getElementById("inputTxt2").value); }); function escapeRegExp(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); } function walk(node, v, p){ var child, next; switch (node.nodeType){ case 1: // Element case 9: // Document case 11: // Document fragment child = node.firstChild; while (child){ next = child.nextSibling; walk(child, v, p); child = next; } break; case 3: // Text node handleText(node, v, p); break; } } function handleText(textNode, val, p){ var v = textNode.nodeValue; v = v.replace(val, p); textNode.nodeValue = v; }
Y/N Y/L/N









