用struts开发的多个程序源代码
源代码在线查看: function.html
/*var msg = "全局变量";
function square(x,y)
{
var sum;
sum = x*x + y*y;
return sum;
}
function show()
{
var msg = "局部变量";
alert(msg);
}
var sum;
alert("sum=" + sum);//此时sum的值为undefined
sum=square(2,3);
alert("sum=" + sum);
//上面的两条语句可以改写成下面的被注释的语句
//alert("sum=" + square(2,3));
show();*/
var msg = "全局变量";
function show()
{
var msg;
msg = "局部变量";
}
show();
alert(msg);
/*function testParams()
{
var params = "";
for(var i=0; i {
params += " " + arguments[i];
}
alert(params);
}
testParams("abc",123);
testParams(123,456,"abc");*/
/*var square = new Function("x","y","var sum;sum=x*x + y*y;return sum;");*/
function square(x,y)
{
var sum;
sum=x*x + y*y;
return sum;
}
alert(square(2,3));
//var urlStr = encodeURI("http://www.it315.org/index.html?country=中国&name=z x");
var urlStr = decodeURI("http://www.it315.org/index.html?country=%E4%B8%AD%E5%9B%BD&name=z%20x");
alert(("123abc" + 1) + "\n" + (parseInt("123abc",10) +1));