代码不在线工作,但在localhost中工作

Code is not working online but working in localhost

本文关键字:工作 localhost 但在 在线 代码      更新时间:2023-09-26

Hello下面的函数包含一个在localhost中正常工作的图像,但每当我将其上传到cpanel时,它就无法在线工作。

这是代码:

function CONshowElements()
{
var Construction = "<center><img src='images/SCALE Construction.PNG'></center><br>The construction company with several years of experience in projects valued over millions of USD having Service and Quality with satisfaction and appreciation of the clients.";
document.getElementById("contents").innerHTML = Construction;
}

您的服务器可能在Linux下运行,而本地主机可能在Windows下运行
这意味着图像文件名区分大小写。

检查您的图像名称是否真的是

SCALE Construction.PNG

而不是

SCALE Construction.png 

如果是这样的话,那么在开发控制台上会得到一个404
此外,文件名中的空白是一个非常糟糕的主意