html简单登陆页面,当用户名输入W,密码输入123456是跳转页面到0.html可以实现吗?怎么实现?

<head>
<title>简单登陆页面</title>
<script>
function r()
{
var username=document.getElementById("username");
var pass=document.getElementById("password");
if(username.value=="")
{
alert("请输入用户名");
username.focus();
return;
}
else if(pass.value=="")
{
alert("请输入密码");
return;
}
else if((pass.value=="123456")&&(username.value=="W"))
{
<Meta http-equiv="refresh" content="1;url=0.htm">;
return;
}
else
{
alert("登录失败,请检查用户名和密码是否有误!");
return;
}
return true;
}
</script>
</head>
<body>
<form>
<table >
<tr align=center>
<td>用户名:</td><td><input type="text" name="username" id="username"></td>
</tr>
<tr align=center><td>密 码:</td><td><input type="password" name="password" id="password"></td></tr>

<tr align=center><td colspan="2"><input type="button" value="登 录" onclick="r();"/>
<input type="reset" value="重 置"/></td></tr>

</table>
</form>
</body>
</html>

1、打开开发工具ecplipse,点击ecplipse导航栏上的【File】-->New--->Maven Project,来新建个WEB工程。

2、新建好WEB工程后,在pox文件里添加所需要依赖的jar包。

3、jar导入后,在WEB工程下的source文件里新建包路径,然后在新建个controller,这里新建了个JumpPageController。

4、Controller类写好后,就来写下跳转的页面吧,这样跳转页面写的很简单,就是Controller类跳转过来,传递过来一个那么,在这里我们输入这个name并欢迎。

5、代码实现好后,在resources文件夹下配置下spring-mvc.xml文件内容,这样主要配置的是扫描注解的包和springmvc的视图解析器。

6、然后再点击eclipse菜单栏上面的Run Configurations来配置项目的启动项。

7、在打开的Run Configurations对话框里,按照下面的配置,然后点击Run进行启动。


温馨提示:答案为网友推荐,仅供参考