在IE 7中意外调用方法或属性访问 [英] Unexpected call to method or property access in IE 7

查看:330
本文介绍了在IE 7中意外调用方法或属性访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了工作,我需要让我们的网站在IE7中运行。因为,众所周知,企业界无法升级。

For work, I need to get our site working in IE7. Because, as we all know, the corporate world can't upgrade.

我正在使用IE8的IE7仿真模式来测试网站,而使用IE8的精彩调试器一直是噩梦。

I am using IE8's IE7 emulation mode to test the site, and using IE8's wonderful debugger has been a nightmare.

我最近的问题是以下错误:

My most recent problem is the following error:

Unexpected call to method or property access.  jquery.js, line 113 character 460

我放了 console.log 命令在我的函数的每一行上,并找出导致错误的行。

I've put console.log commands on every line of my function, and figured out the line that's causing the error.

var $loading = $('<span/>').addClass('span-icon icon-ajax-loader').html('Loading...');

此行适用于Firefox和Chrome。哦,它在IE8的JavaScript控制台中输入时工作正常。

This line works fine in Firefox and Chrome. Oh, and it works fine when entering it into IE8's JavaScript console.

为什么这一行会给意外调用方法或属性访问?我认为对方法或属性的调用是完全可以预期的。

Why would this line give Unexpected call to method or property access? I think the call to the method or property was totally expected.

更新:根据@Pointy的建议,我将该行分成3行。

UPDATE: As per @Pointy's suggestion I broke that line into 3 lines.

var $loading = $('<span/>');
$loading.addClass('span-icon icon-ajax-loader');
$loading.html('Loading...');

现在我收到此次电话的错误 $ loading.html( '正在载入'); 。再次,如果我将此代码粘贴到IE8的开发人员工具中并运行它,它可以正常工作。

Now I'm getting the error on this call $loading.html('Loading...');. Again, if I paste this code into IE8's developer tools and run it, it works fine.

推荐答案

你在哪里注入内容?你看过这个问题和答案吗?
Javascript IE错误:意外调用方法或属性访问

Where are you injecting the content? Have you looked at this question and answer? Javascript IE error: unexpected call to method or property access

这篇关于在IE 7中意外调用方法或属性访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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