{"id":269490,"date":"2015-12-02T16:24:02","date_gmt":"2015-12-02T13:24:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=269490"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=269490","title":{"rendered":"Node.textContent \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a Node.innerHTML \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 javascript \u0438\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u044f \u0432 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430"},"content":{"rendered":"<p>       \u041a\u0440\u043e\u0441\u0441\u0431\u0440\u0430\u0437\u0443\u0440\u0435\u043d\u0430\u044f, \u043a\u0440\u043e\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u044f (set) Node.textContent:<\/p>\n<pre><code class=\"html\">&lt;a href=&quot;javascript:document.body.textContent = '&lt;div&gt;text&lt;\/div&gt;';&quot;&gt;click&lt;\/a&gt; <\/code><\/pre>\n<p>  \u0412\u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u0430\u043a html \u043a\u043e\u0434:<\/p>\n<pre><code class=\"html\">&lt;div&gt;text&lt;\/div&gt; <\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 ASCII \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 32-126. \u041e\u0434\u0438\u043d \u0438\u0437 \u044d\u0442\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u2014 \u0437\u043d\u0430\u043a \u043c\u0435\u043d\u044c\u0448\u0435 (&quot;&lt;&quot;). \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u043e\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0443 (bookmark) \u0432 \u0431\u0440\u0430\u0437\u0443\u0440\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432 url \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b javascript.<\/p>\n<p>  JS \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u0438\u043d\u043e\u0439 n \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 ASCII \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e document.body.textContent.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Url \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438<\/b><\/p>\n<div class=\"spoiler_text\"><code> javascript:for(var a=[],i=0;i&lt;95;i++)a.push(String.fromCharCode(32 + i));for(var b=&quot;&quot;,i=0;i&lt;16;i++)b+=a[Math.floor(Math.random()*95)];document.body.textContent = b; <\/code>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 js<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">document.body.textContent = createPassword();  function createPassword() {     var PASSWORD_LENGTH = 16;      var random = Math.random;     var allowedChars = getAllowedCharsArr();      for (var password = &quot;&quot;, i = 0; i &lt; PASSWORD_LENGTH; i++) {         var randomIndex = Math.floor(random() * allowedChars.length);         password += allowedChars[randomIndex]     }      return password; }  function getAllowedCharsArr() {     var FIRST_ALLOWED_ASCII_CHAR_INDEX = 32;     var ALLOWED_CHARS_COUNT = 95;      for (var allowedChars = [], i = 0; i &lt; ALLOWED_CHARS_COUNT; i++) {         var asciiCode = FIRST_ALLOWED_ASCII_CHAR_INDEX + i;         var char = String.fromCharCode(asciiCode);         allowedChars.push(char)     }      return allowedChars; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0442.\u0435. \u043f\u0435\u0440\u0432\u044b\u0435 k \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438\u0437 \u0432\u0441\u0435\u0445, \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u044b\u0445 n.<\/p>\n<h2>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">document.body.textContent = '&lt;div&gt;text&lt;\/div&gt;'; <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0438\u043b\u0438 \u0432 script \u0442\u0435\u0433\u0435 html, javascript \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043d\u0430\u0434\u043e, \u0442.\u0435. \u0432\u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 &quot;&lt;&quot; \u0438 &quot;&gt;&quot;.<\/p>\n<p>  <code> &lt;div&gt;text&lt;\/div&gt; <\/code><\/p>\n<h2>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c<\/h2>\n<p>  \u041d\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 javascript \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f html \u044d\u043b\u0435\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"html\">&lt;a href=&quot;javascript:document.body.textContent = '&lt;div&gt;text&lt;\/div&gt;';&quot;&gt;click&lt;\/a&gt; <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div&gt;text&lt;\/div&gt; <\/code><\/pre>\n<p>  <\/p>\n<h2>\u042d\u0444\u0438\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c<\/h2>\n<p>  \u041f\u0440\u0438\u0447\u0451\u043c \u0435\u0441\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e:<\/p>\n<pre><code class=\"html\">&lt;a href=&quot;javascript:var str='&lt;div&gt;text&lt;\/div&gt;';document.body.textContent = str;window.test=function(){str}&quot;&gt;click&lt;\/a&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043a\u0441\u0442 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043d\u0430\u0434\u043e:<\/p>\n<p>  <code> &lt;div&gt;text&lt;\/div&gt; <\/code><\/p>\n<h2>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041d\u0430 \u0441\u0430\u0439\u0442\u0430\u0445, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0442\u0435\u043a\u0441\u0442 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b javascript \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Node.textContent \u0438\u043b\u0438 Node.innerText \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0433 script.<\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0414\u043b\u044f \u0441\u0435\u0431\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u0442\u0430\u043b\u043e \u043d\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 DOM \u0430 \u0441\u0440\u0430\u0437\u0443 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0432 \u0431\u0443\u0444\u0444\u0435\u0440 \u043e\u0431\u043c\u0435\u043d\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043a\u043b\u0430\u0434\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><code> javascript:for(var a=[],i=0;i&lt;95;i++)a.push(String.fromCharCode(32 + i));for(var b=&quot;&quot;,i=0;i&lt;16;i++)b+=a[Math.floor(Math.random()*95)];var c=document.createElement('input');c.style.opacity=0;document.body.appendChild(c); c.value=b;c.style.position='fixed';c.style.zIndex=1000000;c.focus();c.select(); document.execCommand('Copy');c.remove(); <\/code>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">source<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">copyToClipBoard(createPassword());  function copyToClipBoard(str) {     var input = document.createElement('textarea');     document.body.appendChild(input);     input.value = str;     input.style.position = 'fixed';     input.style.zIndex = 1000000;     input.style.opacity = 0;     input.focus();     input.select();     document.execCommand('Copy');     input.remove(); }  function createPassword() {     var PASSWORD_LENGTH = 16;      var random = Math.random;     var allowedChars = getAllowedCharsArr();      for (var password = &quot;&quot;, i = 0; i &lt; PASSWORD_LENGTH; i++) {         var randomIndex = Math.floor(random() * allowedChars.length);         password += allowedChars[randomIndex]     }      return password; }  function getAllowedCharsArr() {     var FIRST_ALLOWED_ASCII_CHAR_INDEX = 32;     var ALLOWED_CHARS_COUNT = 95;      for (var allowedChars = [], i = 0; i &lt; ALLOWED_CHARS_COUNT; i++) {         var asciiCode = FIRST_ALLOWED_ASCII_CHAR_INDEX + i;         var char = String.fromCharCode(asciiCode);         allowedChars.push(char)     }      return allowedChars; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  P.S.: \u0412\u043c\u0435\u0441\u0442\u043e \u0446\u0438\u043a\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Array.map. \u041a\u0442\u043e-\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e \u0442\u0430\u043a \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u0435\u0435, \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0435\u043b\u043e \u0432\u043a\u0443\u0441\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><code> javascript:var a = Array.apply(null, Array(127)).map(String.fromCharCode, String).slice(32);var b = Array.apply(null, Array(16)).map(() =&gt; a[Math.floor(Math.random() * 95)]).join(&quot;&quot;);var c = document.createElement('input');document.body.appendChild(c);c.value = b;c.style.position = 'fixed';c.style.zIndex = 1000000;c.style.opacity = 0;c.focus();c.select();document.execCommand('Copy');c.remove(); <\/code>  <\/div>\n<\/div>\n<p>  P.P.S.: \u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c extenshion: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, chrome \u2014 \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u043e \u0432\u043a\u0443\u0441\u0430.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/272189\/\"> http:\/\/habrahabr.ru\/post\/272189\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u041a\u0440\u043e\u0441\u0441\u0431\u0440\u0430\u0437\u0443\u0440\u0435\u043d\u0430\u044f, \u043a\u0440\u043e\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u044f (set) Node.textContent:<\/p>\n<pre><code class=\"html\">&lt;a href=&quot;javascript:document.body.textContent = '&lt;div&gt;text&lt;\/div&gt;';&quot;&gt;click&lt;\/a&gt; <\/code><\/pre>\n<p>  \u0412\u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u0430\u043a html \u043a\u043e\u0434:<\/p>\n<pre><code class=\"html\">&lt;div&gt;text&lt;\/div&gt; <\/code><\/pre>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-269490","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=269490"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269490\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=269490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=269490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=269490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}