getElementByID with document.reffer?

左心房为你撑大大i 提交于 2019-12-11 17:35:23

问题


I am new to both Javascript and php. I have a site with a form that goes through some php mumbo jumbo. After that, I check my database to see if the login credentials exist. If they don't, I want to show a div that contains the error message.

oldURL = document.referrer;
console.log(oldURL);
if (oldURL =="http://amazingwebsite.com/") {
    document.getElementById("loginfail").removeAttribute("hidden");
    document.getElementById("textlogin").removeAttribute("hidden");
}

oldURL returns the exact url that I have in my if statement. However, the if statement only works if I have oldURL to 'not equal' (==!).

What have I missed?


回答1:


Thx to @T30, I figured it out. Was apparently a problem with the CSS not anything with the php code or the javascript.



来源:https://stackoverflow.com/questions/46643399/getelementbyid-with-document-reffer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!