为什么不“加载"事件处理程序绑定到< applet&gt ;,被叫? [英] Why doesn't 'load' event handler bound to an <applet> get called?

查看:97
本文介绍了为什么不“加载"事件处理程序绑定到< applet&gt ;,被叫?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个在< 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).

这篇关于为什么不“加载"事件处理程序绑定到&lt; applet&gt ;,被叫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆