为什么不“加载"事件处理程序绑定到< applet> ;,被叫? [英] Why doesn't 'load' event handler bound to an <applet> get called?
问题描述
我想要一个在< applet>之后执行的回调.元素已加载:
I want a callback that is executed after an <applet> element is loaded:
// Create element
var $applet = $("<applet></applet>");
// Attach handler
$applet.load(function() {
alert('applet loaded');
});
// Set attributes
$applet.attr({
style: 'position:absolute;left:-1px',
name: 'TiddlySaver',
code: 'TiddlySaver.class',
archive: 'TiddlySaver.jar',
width:'1',
height:'1',
});
为什么未对< applet>执行加载"事件处理程序?如果我更改了< applet>元素,到< img>元素(具有有效的src属性)已执行处理程序 .
Why is the 'load' event handler not executed for an <applet> element? If I change the <applet> to an <img> element (with valid src attribute) the handler is executed.
推荐答案
根据HTML 4.01(这是网页的基本标准),只有两个元素具有onload属性:body和frameset.其他一些元素也将其作为专有扩展来支持(图像相当常见),但是您不应期望任何其他元素能够这样做.
According to the HTML 4.01 (which is the fundamental standard for web pages), only two elements have an onload attribute: body and frameset. Some other elements also support it as a proprietary extension (image is fairly common), but you should not expect any other element to do so.
HTML5需要所有HTML元素(特殊的body除外)才能支持load事件,但是您不能依靠它被广泛或完全实现(如果有的话).
HTML5 requires all HTML elements (except body, which is peculiar) to support a load event, but you can't depend on it being widely or fully implemented yet (if ever).
这篇关于为什么不“加载"事件处理程序绑定到< applet> ;,被叫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!