javascript不调用IE9 [英] javascript not calling in IE9

查看:66
本文介绍了javascript不调用IE9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个文本框并写了onfocus="getFocus()"

I created a textbox and wrote onfocus="getFocus()"

现在我用JavaScript编写了函数

Now I wrote function in javascript

function getFocus()

        {
            alert('Hello I Got Focus !!');
        }

问题是在IE8中运行正常,但在IE9中未显示警报. 谁能告诉我代码有什么问题吗?

The problem is in IE8 it worked perfectly, but in IE9 alert is not showing. Can anyone tell what is wrong with the code ??

我也尝试过

txtAmt.Attributes.Add("onfocus","getFocus()")

但仍然没有用

我也尝试过

txtAmt.Attributes.Add("onfocus","javascript:getFocus();")

现在我很担心..该怎么办??

Now i am worried.. what to do ??

推荐答案

页面加载后,打开IE开发人员工具(F12).

Open up the IE developer tool (F12) after your page is loaded.

检查浏览器模式:和文档模式:

Check the Browser Mode: and Document Mode:

尝试将浏览器模式设置为IE9,将文档模式设置为IE9标准.

Try setting Browser Mode to IE9, and Document Mode to IE9 Standards.

现在再试一次,看看是否可行.

Now try again and see if that works.

这篇关于javascript不调用IE9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆