I found the following and the original function [foo0()] works well
I tried to modify it and the second version [foo1()] doesn’t work worth a flip.
The error console complains that ‘argv.join’ is not a function.
Anybody have any idea what is different behind the logic of the functions? ?
[code=php]
<HTML>
<HEAD>
<SCRIPT Language=”JavaScript”>
function foo0() {
var argv = foo0.arguments;
var argc = argv.length;
var str = ‘Arguments: n’;
for (var i = 0; i < argc; i++) { str += i + ” = ” + argv[i]+’n’; }
alert(str);
}
function foo1() {
var argv = foo1.arguments;
var str = ‘Arguments: n’;
str += argv.join(‘|’);
alert(str);
}
</SCRIPT>
</HEAD>
<!– BODY onload=”foo(‘hello’, ‘world’);” –>
<BODY>
<button onClick=”foo0(‘p1′,’p2′,’p3’)”>Pass Params Orig</button>
<button onClick=”foo1(‘p1′,’p2′,’p3’)”>Pass Params Alt.</button>
</BODY>
</HTML>