开发者

JavaScript works under Firefox but does not work under IE

开发者 https://www.devze.com 2023-01-12 15:40 出处:网络
I am having the following HTML file protected through JavaScript. It works fine with Firefox, howover, when it is opened with IE, the JavaScript seems not get invoked. The grading.pdf is directly dis

I am having the following HTML file protected through JavaScript.

It works fine with Firefox, howover, when it is opened with IE, the JavaScript seems not get invoked. The grading.pdf is directly displayed after clicking the hyperlink.

<HTML>
<HEAD>
<TITLE>JavaScript Example 8</TITLE>

<SCRIPT language="JavaScript">
<!--------

var password;

 var pass1="test";

 password=prompt('Please enter your password to view this page!',' ');

 if (password==pass1)
     alert('Password Correct! Click OK to enter!');
 else
    {
    window.location="jpass.htm";
     }

 //----------->
</SCRIPT>

</HEAD>

 <BODY bgcolor="#FFFFFF" text="#000000">

 <!--<H1 align="center"><a href="grades.pdf">gradi开发者_开发技巧ng</a></H1>-->

 <CENTER>
 <!--<A HREF="grades.htm">Grading</A>-->
<a href="grades.pdf">grading</a>


IE 8 and above makes prompt an unsafe method, which may be ignored or called with a security confirmation, as set in advanced properties of IE by the user. (IE uses activeX in window.prompt)

Security updates may also apply this behavior to IE7.

Get the input from an input field instead of a prompt, at least in IE.

0

精彩评论

暂无评论...
验证码 换一张
取 消