- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我调用 index.js 时,它在我的虚拟主机服务器和 cdn 中也不起作用,但在我的本地 xampp 服务器上运行良好。
<?php
/* Main page with two forms: sign up and log in */
require 'db.php';
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Sign-Up/Login Form</title>
<?php include 'css/css.html'; ?>
</head>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (isset($_POST['login'])) { //user logging in
require 'login.php';
}
elseif (isset($_POST['register'])) { //user registering
require 'register.php';
}
}
?>
<body>
<div class="form">
<ul class="tab-group">
<li class="tab"><a href="#signup">Sign Up</a></li>
<li class="tab active"><a href="#login">Log in</a></li>
</ul>
<div class="tab-content">
<div id="login">
<h1>Welcome to </h1>
<form action="index.php" method="post" autocomplete="off">
<div class="field-wrap">
<label>
Email Address<span class="req">*</span>
</label>
<input type="email" required autocomplete="off"
name="email"/>
</div>
<div class="field-wrap">
<label>
Password<span class="req">*</span>
</label>
<input type="password" required autocomplete="off"
name="password"/>
</div>
<p class="forgot"><a href="forgot.php">Forgot Password?</a></p>
<button class="button button-block" name="login" />Log
In</button>
</form>
</div>
<div id="signup">
<h1>Sign Up for Free</h1>
<form action="index.php" method="post" id="form1"
autocomplete="off">
<div class="top-row">
<div class="field-wrap">
<label>
First Name<span class="req">*</span>
</label>
<input type="text" required autocomplete="off"
name='firstname' id="txtNumeric" />
</div>
<div class="field-wrap">
<label>
Last Name<span class="req">*</span>
</label>
<input type="text"required autocomplete="off"
name='lastname'
id="txtNumeric" />
</div>
</div>
<div class="field-wrap">
<label>
Contact number<span class="req">*</span>
</label>
<input type="number"required autocomplete="off"
name='contact'
onclick="return AllowSingleSpaceNotInFirstAndLast();" />
</div>
<div class="field-wrap">
<label>
Email Address<span class="req">*</span>
</label>
<input type="email"required autocomplete="off" name='email'
onclick="return AllowSingleSpaceNotInFirstAndLast();" />
</div>
<div class="field-wrap">
<label>
Set A Password<span class="req">*</span>
</label>
<input type="password"required autocomplete="off"
name='password'/>
</div>
<button type="submit" class="button button-block"
name="register"
onclick="return validates()" />Register</button>
</form>
</div>
</div><!-- tab-content -->
</div> <!-- /form -->
<script
src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'>
</script>
<script src="js/index.js"></script>
<script type="text/javascript">
function validates(){
$(function() {
$('#txtNumeric').keydown(function (e) {
if (e.shiftKey || e.ctrlKey || e.altKey) {
e.preventDefault();
} else {
var key = e.keyCode;
if (!((key == 8) || (key == 32) || (key == 46) || (key >= 35 && key
<=
40) || (key >= 65 && key <= 90))) {
e.preventDefault();
}
}
});
});
function AllowSingleSpaceNotInFirstAndLast() {
var obj = document.getElementById('TextBox1');
obj.value = obj.value.replace(/^\s+|\s+$/g, "");
var CharArray = obj.value.split(" ");
if (CharArray.length > 2) {
alert("User name NOT VALID");
return false;
}[enter image description here][1]
else {
alert("User name VALID");
}
return true;
}
}
</script>
</body>
</html>
这里的问题是我无法在我的虚拟主机中正确运行代码。我的代码在本地 xampp 服务器上运行良好。我还编辑了数据库用户、数据库名称等,但没有帮助。谁能帮帮我?
谢谢!
附言。我是 stackoverflow 的新手。抱歉我的格式错误
最佳答案
我认为问题出在你的文件路径你应该检查你的文件路径或者可能是您没有在服务器上上传带有正确代码的所有文件。
替换这段代码
<script src="js/index.js"></script>
到
<script src="<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>/js/index.js"></script>
关于javascript - JS 文件在 webhost 中不工作,但在我的本地 xampp 上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50712756/
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this q
在 docs.microsoft 上的以下帖子的帮助下,我正在从 ASP.NET Core 1.x 迁移到 v2.0: https://learn.microsoft.com/en-us/aspnet
虚拟主机服务,提供一种既便宜又简单的方式,使企业或个人在网路上尽情展示自己公司的形象、产品。您不但能马上拥有专属的独立网址,又能省下单独承受购买网路伺服器、专线架设及资讯工程人员等庞大成本。透过虚拟
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 8年前关闭。 Improve this q
我在负载均衡器后面部署了一个 WCF 服务,当我尝试使用 SOAP 访问它时,它工作得很好,但是当我尝试通过 REST url 访问它时,我收到下面提到的错误。 这是我尝试通过 https://dev
在本地主机上这效果很好。但是当我将文件上传到服务器时,我收到此错误: 警告:mysql_num_rows():提供的参数不是第 54 行/storage/content/04/13fd39104/xx
我现在花了很多时间来配置我的代理。目前,我使用一项名为 proxybonanza 的服务。他们为我提供了一个代理,我用它来获取网页。 我正在使用 HTMLAGILITYPACK 现在,如果我在没有代理
我使用免费的虚拟主机 000webhost。该服务还可以,但它会在每个文件和请求中插入一些 javascript 计数器。脚本如下所示。 如果我做一个 jquery post 它会破坏我的代码
在我的 Program.cs Main 方法中,我想读取 user secrets ,配置记录器,然后构建 WebHost。 public static Main(string[] args) {
我经常使用 WebHost.CreateDefaultBuilder(args) 在我的 ASP.NET Core 应用程序上启动我的 kestrel 服务器,args 从命令行获取。我无法在任何地方
将 MVC 网页部署到我的 IIS 后,出现以下错误: Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.
尝试关注@matthoneycutt的tutorial on Azure IoT Hub这好像是Microsoft.Azure.WebHosts.JobHostConfiguration 在 3.0.
我仍在寻找可用于我的虚拟主机提供商服务器 (one.com) 的搜索引擎,但仍未找到。 我听说 Sphinx 很棒,运行它有哪些要求? 说明书看了,不多说了,感觉应该可以吧...只是想先请教专业人士。
我正在寻找一种方法来显示从虚拟主机到 Windows 边栏小工具的信息列表。我可以看到一个使用 iframe 的解决方案,但我知道实际使用它并不是一个聪明的主意。我读过有一种方法可以使用某种 java
从 .NET Core 2.0 升级到 .NET Core 2.1 错误WebHostBuilder 只允许创建单个 WebHost 实例 程序.cs namespace WebApp1 {
我只是想了解 webapi、webhost (iis) 和 owin 之间的关系。我把我目前的理解写下来,请大家告诉我是否正确。 Webapi,与 MVC 不同,是以独立于主机的方式编写的。那是在欧文
我有一个 ASP.NET Core 应用程序,我想在其中隐藏启动应用程序时显示的控制台行(因为我有自己的欢迎消息) Hosting environment: Development Content r
我使用 Code Ignitor 和 MySQL 创建了一个网站,并希望将所有内容上传到 000webhost.com 我该怎么办: 将我的模型、 View 和 Controller 上传到 000w
如描述所述,由于某种原因,解决方案突然找不到 System.Web.Http.WebHost。 最佳答案 通过安装 NuGet Microsoft.AspNet.WebApi.WebHost 解决了这
我是一名优秀的程序员,十分优秀!