-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哈哈不用擔心。我也覺得啞巴。如果我剛剛在代碼中滾動,我會注意到這一點,並能夠給出更具體的建議。 –