2024-05-05 02:31:45
你好,能告诉我怎么用js 跳转?
2024-05-05 01:33:50
<script language="JavaScript">
<!--
function landing(){
form.action ="landing_ex.php"
}
function reg() {
form.action="zc.php"
}
</script>
<form method="post" action= "" name="form">
<input type="submit" onclick="landing()">
<input type="submit" onclick="reg()">
</form>
请问为什么按照你说的写但是跳转不过去,是不是我哪写错了
<head>
<title>无标题文档</title>
<script language="JavaScript">
<!--
function landing(){
form.action ="landing_ex.php"
}
function reg() {
form.action="zc.php"
}
</script>
</head>
<body>
<form method="post" name="form">
<input name="landingUser" type="text" id="landingUser" />
<input name="landingPass" type="text" id="landingPass" />
<input name="dl" type="submit" id="dl" value="登录" onclick="landing()">
<input name="dl" type="submit" id="dl" value="注册" onclick="reg()">
</form>
</body>
</html>
<input name="dl" type="button" id="dl" value="注册" onclick="reg()">
你这里写成button了,所以注册跳转不了,我测试了,没有问题,可以跳转的。
以下是我测试用的php
landing_ex.php
<?php
$user=$_POST['landingUser'];
$pass=$_POST['landingPass'];
$name="用户名:";
$mima="密码:";
echo "<h3>登录</h3><br/>";
echo $name. $user;
echo $mima.$pass;
?>
zc.php
<?php
$user=$_POST['landingUser'];
$pass=$_POST['landingPass'];
$name="您注册的用户名:";
$mima="您的密码密码:";
echo "<h3>注册成功</h3><br/>";
echo $name. $user;
echo $mima.$pass;
?>
我擦..我服了,这个网友采纳的管理员什么都不懂么......!!!
2024-05-05 02:03:45