Heim >Web-Frontend >HTML-Tutorial >cnzz代码添加元素到页面_html/css_WEB-ITnose

cnzz代码添加元素到页面_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:52:511936Durchsuche

首先在cnzz上注册账号后,他会给你如下代码:

<span style="font-size:18px;"><script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_xxxxxxxxxx'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1252929438%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script></span>
这段js代码的意思是,

根据当前页面所使用的传输协议来定义变量cnzz_protocol,如果是https协议,则cnzz_protocol="https://",否则为="http://"。

document.write()这个命令简单地打印指定的文本内容到页面上。

unescape() 函数可对通过 escape() 编码的字符串进行解码。站长工具,我是在这里解码的,大家可以百度“unescape解码”,有很多在线解码工具的。


通过unescape()函数解码,我们可以得到:

<span style="font-size:18px;">"<span id="cnzz_stat_icon_1252929438"></span><script src="%22%20+%20cnzz_protocol%20+%20%22s19.cnzz.com/z_stat.php?id=xxxxxxxxxx&show=pic1" type="text/javascript"></script>"</span>
他创建了一个span元素,添加了一个script。


这个script执行完毕后,页面变成下面

<span style="font-size:18px;"><span id="cnzz_stat_icon_1252929438">    <a href="http://www.cnzz.com/stat/website.php?web_id=xxxxxxxxxx" target="_blank" title="站长统计">        <img  src="/static/imghwm/default1.png" data-src="http://icon.cnzz.com/img/pic1.gif" class="lazy" border="0" hspace="0" vspace="0" alt="cnzz代码添加元素到页面_html/css_WEB-ITnose" >    </a></span></span>
<span   style="max-width:90%"><script src="http://s19.cnzz.com/z_stat.php?id=xxxxxxxxxx&show=pic1" type="text/javascript"></script></span>
<span style="font-size:18px;"><script src="http://c.cnzz.com/core.php?web_id=xxxxxxxxxx&show=pic1&t=z" charset="utf-8" type="text/javascript"></script></span>

关于其流量统计的原理,大家可以参看这篇文章: CNZZ网站流量统计原理简析

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn