我有一个非常简单的任务,它只是不工作,我不知道为什么。我有一个 PHP 文件(其中大部分是 HTML),我只是将它复制到同一文件夹中的另一个文件中,期望具有相同的功能。我有两个按钮应该在按下时弹出一个窗口,但是在新页面中,每当按下一个按钮时,我都会在 URL 中获得 pageURL+ #id 的表单,但什么也没有发生。例如:“{/project/login.php#loginmode}” //是的,它在本地主机上
我理解它的方式,id 在一个页面中必须是唯一的,但它们在文件夹内的页面中也应该是唯一的吗?我尝试更改 id 名称,却发现新的 id 名称出现在 URL 中。我还尝试将原始文件复制到一个完全不同的目录,但仍然是同样的问题。然后我尝试在那里更改 ID 名称,但仍然不行。我错过了什么??我已经重新启动了我的服务器并多次清除了我的缓存...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf=8"/>
<title>TITLE/title>
<link rel="stylesheet" type="text/css" href="style.css" me2dia="screen" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link href='http://fonts.googleapis.com/css?family=Terminal+Dosis' rel='stylesheet' type='text/css' />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.leanModal.min.js"></script>
<div id = "top">
<center>
<nav>
<a class="navbtn" href="about.php" style="padding: 0px 10px 0px 10px"> ABOUT</a> |
<a href="#loginmode" class="navbtn modaltrigger" style="padding: 0px 10px 0px 10px"> LOGIN </a> |
<a href="#contactmodal" class="navbtn modaltrigger" style="padding: 0px 10px 0px 10px"> CONTACT</a>
</nav>
</center>
</br></br></br>
</div>
<!--script for checking logging and creating user-->
<script type = "text/javascript">
function checkLogin(){
var u = document.getElementById("username").value;
var p = document.getElementById("password").value;
var xmlhttp;
if (window.XMLHttpRequest) //using AJAX
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
//using AJAX:
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
if(xmlhttp.responseText == u){
alert('You have entered a correct username and/or password.');
window.location = 'home.php'; //should change from home to newposting.php???
}
else{
alert('You have entered an incorrect username/password combination. Please try again.');
//href=\"javascript:history.go(-2)\"
//window.location = 'loginredo.php';
}
}
}
xmlhttp.open("GET", "checkpw.php?u=" + u + "&p=" + p, true);
xmlhttp.send();
}
function newUser(){
location.href = 'signup.php';
}
</script>
</head>
<body>
<center>
<!--Login-->
<div id="loginmode" style="display:none;">
<logh1>Sign In:</logh1>
<form id="loginforme" name="loginforme" method="post" action="index.html">
<label for="username"><h2>Username:</h2></label>
<input type="text" name="username" id="username" class="txtfield" tabindex="1">
<label for="password"><h2>Password:</h2></label>
<input type="password" name="password" id="password" class="txtfield" tabindex="2">
<div class="center">
<input type="submit" name="loginbtn" id="loginbtn" class="flatbtn-blu hidemodal" value="Log In" onclick="checkLogin(); return false;" tabindex="3">
<input type="submit" name="newusrbtn" id="create-user"" class="flatbtn-blu hidemodal" value="New User" onclick="newUser();" tabindex="4">
</div>
</form>
</div>
<!--Contact-->
<div id="contactmodal" style="display:none;">
<logh1>Contact GULSEN:</logh1>
<form name="contactform" action="contact.php" method="post"> <!--cannot have id="contactform"-->
<label for="cf_first_name"><h2>First Name</h2></label>
<input type="text" name="cf_first_name" class="txtfield" tabindex="1">
<label for="cf_last_name"><h2>Last Name</h2></label>
<input type="text" name="cf_last_name" class="txtfield" tabindex="2">
<label for="cf_email"><h2>Email Address</h2></label>
<input type="text" name="cf_email" id="cf_email" class="txtfield" tabindex="3">
<label for="password"><h2>Message</h2></label>
<textarea name="cf_message" cols="100" rows="5" class="txtfield" tabindex="4" style="resize: none; outline: none"></textarea>
<label for="cf_reference"><h2>How did you hear about GULSEN?</h2></label>
<input type="text" name="cf_reference" id="cf_reference" class="txtfield" tabindex="5">
<div class="center">
<input type="submit" class="flatbtn-blu" value="Send">
<input type="reset" class="flatbtn-blu" value="Clear">
</div>
</form>
</div>
</center>
<script type="text/javascript">
$(function(){
$('#loginforme').submit(function(e){
return false;
});
$('#contactform').submit(function(e){
return false;
});
$('.modaltrigger').leanModal({ top: 110, overlay: 0.45, closeButton: ".hidemodal" });
});
</script>
<div id="footer"></div>
</body>
</html>