English 中文(简体)
要求采用的方法 传真元件,如立克式处理器
原标题:Calling methods in RequireJs modules from HTML elements such as onclick handlers
最佳回答
问题回答

你们还可以把 reference印的窗户分类作为参考。

申请模块底部window。 MyApi = MyApi;

<a category=“button”href=“#” onclick=“MyApi.foo();”></a>

onclick="置于你的标识内感到 d脏——列报方式与内容相结合。 d 我建议添加<代码><script>栏,并将require<>/code>列入其中,一在背书内,一在另一内部$(document)ready()。 如有必要,则按正常方式对事件处理器进行电解:$(#node .click(......)。 如果你能够以笼统的方式这样做,使之适用于多页,那么就把它放在一个外部档案中,而外部档案是分明、合并和贴切的。 但是,通常这些事情最终都是针对具体页的,因此,一个<代码><script> 标签在网页底部是避免另一个外部资源要求的良好解决办法。

另一种解决办法是像使用法(课程编号requirejs)。 页: 1

<input type="button" onclick="(function() { require( mymodule ).do_work() })()"/>




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

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!

热门标签