开发者

edit javascript on the fly

I was curious how I might go about editing a variable on t开发者_开发知识库he fly, since whenever I try nothing happens. Take http://nyan.cat for example. I tried to edit the seconds variable, but nothing happened - why?

i used (in the JS console) seconds = 9001; RET and nothing happens....


That's because in http://nyan.cat/ the seconds variable is being set by the script repeatedly, based on the startTime Date object. In the specific case of http://nyan.cat/, to 'hack' the time, change the startTime.

Example: to increase your seconds by 1234567 seconds:

startTime = new Date(((+startTime/1000)-1234567)*1000);


What JS console are you using?In the firebug?

Here I tested it.

var seconds = 9001;

alert(seconds);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜