今天在网上看到一句javascript程序非常有点意思,照着写了个HTML,你可以测试一下。后面附个两个相关的网页连接,可以进一步去了解。
<html>
<script>
function f_reset1()
{
var g = document.getElementById("gg");
g.innerText = [];
}
function f_reset2()
{
var g = document.getElementById("gg");
g.innerText = ++[[]][+[]];
}
function f_reset3()
{
var g = document.getElementById("gg");
g.innerText = ++[[]][+[]]+[+[]];
}
function f_reset4()
{
var g = document.getElementById("gg");
var l = new Array(); //var l = [];
alert(l);
g.innerText = ++[l][+l]+";"+[+l];
}
</script>
<head>
</head>
<body>
Gu Laicheng, 2012.1.14
<button onClick="f_reset1();" >GO1</button>
<button onClick="f_reset2();" >GO2</button>
<button onClick="f_reset3();" >GO3</button>
<button onClick="f_reset4();" >GO4</button>
<br/>
[<span id=gg >_</span>]
</body>
</html>
相关网站:
http://news.cnblogs.com/n/128394/
http://stackoverflow.com/questions/7202157/can-you-explain-why-10