使 HTML/CSS/Javascript 无法在平板电脑上正常运行



我用一些CSS和JavaScript写了一些基本的HTML。该代码要求用户输入密码,Javascript 验证密码并提醒用户所需的信息。此代码在我的桌面上正常运行,但一旦我将文件添加到我的三星平板电脑,就只显示 HTML。我使用的代码如下。目前运行同一个 fodler 中的所有文件,但希望将主 HTML 移动到平板电脑主页,并将 CSS 和 Javascript 留在另一个位置,但仍被引用。

.HTML

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="dowlingcss.css"/>
<title>
Dr. Dowling
</title>

</head>
<body>  
<script src="dowlingjs.js"></script>    
<img src="parasol.jpg" alt="Parasol Logo" height="250" width="750"> 

<h1>Welcome Dr. Dowling</h1>

<p>What is the answer?</P>
<form>
<input id="pass">
<button type="button" onclick="myfunction()">Login</button>
</form>

</body>
</html>

爪哇语

function myfunction()
{

var x, text;
//Get the value of the input field with id="pass"
x = document.getElementById("pass").value;
var password = x.toLowerCase(); 
// If x is Not = to fatluke
if (password != "fatluke") 
{
alert("incorrect");
}
else {
alert("The CD is in room 125 under the bed");
}
}

将代码添加到此代码块中,以便在页面加载后运行和检查

window.onload = (function () {
// insert your code here
});

另外,尝试使用"window.getElementById((",我认为这取决于您的浏览器和平板电脑上的网络视图版本。

最新更新