分享一个小技巧,个中乐趣请跨站师们自己体会:
<
script
type
="text/javascript"
>
<!--
function func2URL(proc) {
return " javascript:( " + encodeURIComponent(proc.toString()) + " )(); " ;
}
function test() {
var a = " hahaha\x41\x42 " ;
var b = function (s) {
alert(s);
};
b(a);
}
document.write(func2URL(test));
location.href = func2URL(test);
// -->
</ script >
<!--
function func2URL(proc) {
return " javascript:( " + encodeURIComponent(proc.toString()) + " )(); " ;
}
function test() {
var a = " hahaha\x41\x42 " ;
var b = function (s) {
alert(s);
};
b(a);
}
document.write(func2URL(test));
location.href = func2URL(test);
// -->
</ script >