English 中文(简体)
js 电文错误:htmlfile: 未执行
原标题:js error message : htmlfile: Not implemented

我已建造了一个控制参数(html控制参数)的小类,试图在控制上加一个<条码>交换的活动,但我有以下错误:

htmlfile: 未执行

//-------------- the code

Contrl.prototype.AddChangeEvent = function() {

    var element = this.docID;
    var fn = function onChange(element) {
       
     // action
        
       

    };

    if (this.tag == "input" && (this.el.type == "radio")) {
        this.el.onclick = fn(element); // there i have the error 
    }
    else {
        this.el.onchange = fn(element); // there i have the error 
    }
}
最佳回答

this.el.onclick = fn(element), 您将 callsingfn 立即转让任何fn 返回onclick

您需要以匿名身份开展工作,电话fn,以及您希望得到的论据,如:

this.el.onclick = function() { return fn(element); };

然而,这不是在 Java文中指派活动处理员的正确方式。

请打电话attachEvent (for IE) 或addEventListener(for all others),如:

function bind(elem, eventName, handler) {
    if (elem.addEventListener)
        elem.addEventListener(eventName, handler, false);
    else if (elem.attachEvent)
        elem.attachEvent("on" + eventName, handler);
    else
        throw Error("Bad browser");
}
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签