本文介绍了Javascript toSource()方法不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个对象不支持此属性或方法错误,有人知道为什么吗?

I'm getting a "Object doesn't support this property or method error", does anyone know why?

我的值已插入userId,fname ,lname,oname,sam,hasAccess

I do have values plugged into userId, fname, lname, oname, sam, hasAccess

function Employee(id, fname, lname, oname, sam, access) {
    this.id = id;
    this.fname = fname;
    this.lname = lname;
    this.oname = oname
    this.sam = sam;
    this.access = access;
}

var emp = new Employee(userId, fname, lname, oname, sam, hasAccess);

var jsonstuff = emp.toSource(); //Breaking here

虽然此链接显示其可能

Although this link says its possible http://www.w3schools.com/jsref/jsref_toSource_date.asp

推荐答案

toSource()在Internet Explorer或Safari中不起作用。它只是Gecko。有关替代方案,请参阅中实现Mozilla的toSource()方法。

toSource() does not work in Internet Explorer or Safari. It is Gecko-only. See Implementing Mozilla's toSource() method in Internet Explorer for alternatives.

这篇关于Javascript toSource()方法不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 16:12