-1
if (confirm("By clicking Ok, you agree to letting us log your IP! If you say Cancel, you will be sent back to Google's homepage!") != true) {
window.location.replace("http://google.com");
console.log("Website.js, loaded! No ERROR!");
}
h1 {
text-align: center;
padding-top: 50px
}
p {
text-align: center;
font-size: 18px;
}
#pd {
padding-top: 20px;
width: 300px;
margin: auto;
}
ul {
font-size: 18px;
text-align: center;
padding-top: 20px
}
#form {
width: 150px;
margin: auto;
text-align: center;
font-size: 18px;
padding-top: 20px;
}
#clientIP {
font-weight: bold;
font-size: 16;
text-align: center;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1></h1>
<p id="clientIP"></p>
<div id="pd">
<p></p>
<h1></h1>
<ul>
<li></li>
<br>
<li></li>
<br>
<li></li>
<br>
<li></li>
<br>
<li></li>
<br>
</ul>
</div>
<link rel='stylesheet' type='text/css' href='Website.css' />
<script src="Website.js"></script>
<script type="text/javascript" src="https://www.l2.io/ip.js?var=myip"></script>
<script type="text/javascript">
document.getElementById("clientIP").innerHTML = "Your IP is - " + myip;
console.log("File that retrives IP has been run! No ERROR!")
</script>
</body>
</html>
所以我很偏执,因此丢失的文本,但错误的是,当一切都运行和工作,Website.js'日志中没有出现!它烦扰我! Website.js是JS代码.....是的,但我很烦恼,当我检查元素时,日志不会出现!
我觉得真的很愚蠢,但谢谢!大声笑这行应该是在一个else语句! –
@SeandaPotato哈哈不用担心。我也觉得哑巴。如果我刚刚在代码中滚动,我会注意到这一点,并能够给出更具体的建议。 –