在页面上加载所有iframe的全部内容后,警报未显示

时间:2016-11-06 10:43:25

标签: javascript jquery

<!DOCTYPE html>
<html lang="en">
    <head>
         <title>
         </title>
         <meta charset="utf-8" />
         <link rel="stylesheet" type="text/css" href="css/custom.css" />
    </head>
    <body>
          <iframe width="400px" src="http://www.w3schools.com"></iframe>
          <iframe width="400px" src="http://www.phpacademy.org"></iframe>
          <iframe width="400px" src="http://www.jquery.com"></iframe>
    <script type="text/javascript" src="js/jquery-3.1.1.min.js" ></script>
    <script type="text/javascript" src="js/custom.js" ></script>
    </body>
</html>
下面的

是custom.js中的代码

$(window).(on.('load', function () {
    alert('All content loaded.');
}));

我希望在页面上加载所有三个iframe时显示提醒。

2 个答案:

答案 0 :(得分:1)

以这种方式写下

   $(window).load(function() {
    alert("All content loaded.");
  });

答案 1 :(得分:1)

您用于加载的语法错误,您应该使用

$(window).on.('load', function () {
    alert('All content loaded.');
});
相关问题