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

时间:2022-12-06 09:39:32
<!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>

below is code in custom.js

下面是custom.js中的代码

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

I want the alert to display when all the three iframes are loaded on the page.

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

2 个解决方案

#1


1  

The syntax you used for load is wrong, you should use

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

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

#2


1  

Write this way

这样写

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

#1


1  

The syntax you used for load is wrong, you should use

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

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

#2


1  

Write this way

这样写

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