为什么这个简单的JSFiddle不起作用?我想在JSFiddle中添加一些代码。它没用。缩小它我甚至无法使用这个最简单的代码:的jsfiddlefunction displaymessage() {
alert("Hello World!");}<form>
<input type="button" value="Click me!" onclick="displaymessage()" /></form><p>By pressing the button above, a function will be called. The function will alert a message.</p>该alert框未显示在JSFiddle中。
3 回答

慕森王
TA贡献1777条经验 获得超3个赞
您需要将您的功能从onLoad / onReady中取出,否则它将被放置在另一个范围内,并且您的按钮无法访问该功能。在你的情况下,你需要使用无包裹(头)
生成的代码如下所示:
Ext.onReady(function() { function displaymessage() { alert("Hello World!"); }});
添加回答
举报
0/150
提交
取消