[英]Make HTML/CSS/Javascript not properly running on Tablet
我已经用一些CSS和JavaScript编写了一些基本的HTML。 该代码要求用户输入密码,然后Javascript会验证该密码并向用户发出所需的信息。 该代码在我的桌面上可以正常运行,但是一旦我将文件添加到Samsung Tablet中,则仅显示HTML。 我正在使用的代码如下。 当前,所有文件都在同一设备上运行,但希望将主要HTML移至Tablet Home并在另一个位置保留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>
Java脚本
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()”,我认为这取决于您的浏览器和平板电脑上的网络视图版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.