Clicking button does not jump to a particular page in IE9

来源:互联网 发布:漯河淘宝加盟被骗了 编辑:程序博客网 时间:2024/06/07 01:02

Today I write two pages in ie9. One page has a button to click to jump to another page.
Here is my code:

page One:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head></head><body>    <button onclick="myFun()">Click</button><script>var a=1;function myFun(){    console.log(a);//error    self.location="b.html";}</script></body></html>

page Two

<html><body><p>hello</p></body></html>

When first I click the button,nothing works.I do not know what is wrong.Then I want to debug it and press the key f12 on keyboard.Suddenly it works.So strange!
At last I find information on the Internet and got it.The object console is undefined on the page in ie9 unless you press f12 then it will appear.

0 0
原创粉丝点击