错误:“null”为空或不是IE8中的对象,而不是Chrome或Firefox
Error: 'null' is null or not an object in IE8 not Chrome or Firefox
我下载了代码来保护页面。它在Chrome和Firefox中工作正常,但在IE8中则不行。 我使用的是XP SP3。
其他几个人都可以访问它,所以我不想说"在IE8或x或y中不起作用"
与之前的问题不同,它在本地工作,但不能从网络上工作。我的主页有一个指向包含以下代码的文件的链接。在格伦菲斯特的 www.bscomputers.co.uk
请问有解决方法吗? 我无法访问 php 等,这是一个低安全性的东西,所以我想要一个页面解决方案。
代码如下:
<SCRIPT>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password', ' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") { //error on this line
alert('You Got it Right!');
window.open('protectpage.html');
break;
}
testV += 1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.', 'Password');
}
if (pass1.toLowerCase() != "password" & testV == 3)
history.go(-1);
return " ";
}
</SCRIPT>
<CENTER>
<FORM>
<input type="button" value="Enter Protected Area" onClick="passWord()">
</FORM>
</CENTER>
将代码归功于那些似乎没有提供任何帮助的 http://www.javascriptkit.com/。
我不太确定这是否是IE8的问题,但是您正在重新定义每个环通中的pass1变量。在IE中尝试一下。
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password', ' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") { //error on this line
alert('You Got it Right!');
window.open('protectpage.html');
break;
}
testV += 1;
pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.', 'Password');
}
if (pass1.toLowerCase() != "password" & testV == 3)
history.go(-1);
return " ";
}
http://jsfiddle.net/ajY76/
正如NDM已经注意到的那样,这根本不是保护。
相关文章:
- 重载JS'firefox中的对象原型
- querySelectorAll在Firefox Addon中返回带有空对象的数组
- Firefox插件SDK:在侧边栏和主脚本之间通信对象
- 在循环遍历对象 HTMLDivElement 时,应用 ChileNode 样式 zindex 在 firefox 和
- 'object对象'在firefox中,wehn引用了jquery
- 在Firefox中与Web内容(页面对象)共享插件对象(内容脚本)
- Date对象在Chrome中有效,但在Safari、Firefox或IE中无效
- 从函数属性访问对象属性;不适用于Firefox
- 错误:“null”为空或不是IE8中的对象,而不是Chrome或Firefox
- 如何在 Firefox 中查找特定的缓存条目并将它们转换为文件或 Blob 对象
- FireFox 34 中的“DataCloneError: 无法克隆对象”
- Jquery 在 Firefox 中的自定义对象参数(动态导航加载动态内容)
- 原型事件,用于将事件对象复制到 Firefox 的 window.event
- 访问Firefox中的全局事件对象
- 如何在Chrome或Firefox的JavaScript控制台中引用最后一个打印出来的对象
- 为什么使用JavaScript's Date对象在Firefox中无效
- 通过JavaScript引用Firefox事件对象
- flash对象未显示在firefox中
- Firefox无法识别定义对象(Firefox扩展开发)
- Javascript对象firefox观察