主题:简单问题--一个JSP中包含的javascript
今天碰到一个问题,请各位帮忙。。。
我编写了一个javascript程序,结果运行无结果,怎么会事?
程序为:
<html>
<head>
</head>
<body>
<script language="javascript">
fuction f(text)
{
var week="0";
switch(text)
{
case "第一周": week="1";break;
case "第二周": week="2";break;
case "第三周": week="3";break;
case "第四周": week="4";break;
case "第五周": week="5";break;
case "第六周": week="6";break;
case "第七周": week="7";break;
case "第八周": week="8";break;
case "第九周": week="9";break;
case "第十周": week="10";break;
case "第十一周": week="11";break;
case "第十二周": week="12";break;
case "第十三周": week="13";break;
case "第十四周": week="14";break;
case "第十五周": week="15";break;
case "第十六周": week="16";break;
case "第十七周": week="17";break;
case "第十八周": week="18";break;
case "第十九周": week="19";break;
case "第二十周": week="20";break;
}
return week;
}
var x="第十一周";
var z=f(x);
document.writeln(z);
</script>
</body>
</html>
上述代码测试就是没有结果,大家帮忙测试一下,能使之好用最好。
而下面这个没有运用function却可以:
<html>
<head>
</head>
<body>
<script language="javascript">
var text="第九周";
var week;
switch(text)
{
case "第一周": week="1";break;
case "第二周": week="2";break;
case "第三周": week="3";break;
case "第四周": week="4";break;
case "第五周": week="5";break;
case "第六周": week="6";break;
case "第七周": week="7";break;
case "第八周": week="8";break;
case "第九周": week="9";break;
case "第十周": week="10";break;
case "第十一周": week="11";break;
case "第十二周": week="12";break;
case "第十三周": week="13";break;
case "第十四周": week="14";break;
case "第十五周": week="15";break;
case "第十六周": week="16";break;
case "第十七周": week="17";break;
case "第十八周": week="18";break;
case "第十九周": week="19";break;
case "第二十周": week="20";break;
}
document.writeln(week);
</script>
</body>
</html>
谢谢大家!!!
还有在JSP中如何实现参数的传递??
能有一个简单的例子最好。。。
我编写了一个javascript程序,结果运行无结果,怎么会事?
程序为:
<html>
<head>
</head>
<body>
<script language="javascript">
fuction f(text)
{
var week="0";
switch(text)
{
case "第一周": week="1";break;
case "第二周": week="2";break;
case "第三周": week="3";break;
case "第四周": week="4";break;
case "第五周": week="5";break;
case "第六周": week="6";break;
case "第七周": week="7";break;
case "第八周": week="8";break;
case "第九周": week="9";break;
case "第十周": week="10";break;
case "第十一周": week="11";break;
case "第十二周": week="12";break;
case "第十三周": week="13";break;
case "第十四周": week="14";break;
case "第十五周": week="15";break;
case "第十六周": week="16";break;
case "第十七周": week="17";break;
case "第十八周": week="18";break;
case "第十九周": week="19";break;
case "第二十周": week="20";break;
}
return week;
}
var x="第十一周";
var z=f(x);
document.writeln(z);
</script>
</body>
</html>
上述代码测试就是没有结果,大家帮忙测试一下,能使之好用最好。
而下面这个没有运用function却可以:
<html>
<head>
</head>
<body>
<script language="javascript">
var text="第九周";
var week;
switch(text)
{
case "第一周": week="1";break;
case "第二周": week="2";break;
case "第三周": week="3";break;
case "第四周": week="4";break;
case "第五周": week="5";break;
case "第六周": week="6";break;
case "第七周": week="7";break;
case "第八周": week="8";break;
case "第九周": week="9";break;
case "第十周": week="10";break;
case "第十一周": week="11";break;
case "第十二周": week="12";break;
case "第十三周": week="13";break;
case "第十四周": week="14";break;
case "第十五周": week="15";break;
case "第十六周": week="16";break;
case "第十七周": week="17";break;
case "第十八周": week="18";break;
case "第十九周": week="19";break;
case "第二十周": week="20";break;
}
document.writeln(week);
</script>
</body>
</html>
谢谢大家!!!
还有在JSP中如何实现参数的传递??
能有一个简单的例子最好。。。