jquery加载iframe显示正在加载信息

<html>
<head>
<meta http-equiv="contentType" content="text/html;charset=utf-8">
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script>
$(function(){
 
 $("#message").text("正在加载..");
 
    $("#button").click(function(){
        $("#message").text("正在加载..");
        $("#l_iframe").attr("src",http://www.hzhuti.com");
    });
 
    $("#l_iframe").load(function(){
        $("#message").text("");
  alert("加载完成!");
    });
});
</script>
</head>
<body>
<div id="button">点击这里测试加载</div>
<span id="message" style="color:green"></span>
<hr/>
<div id="description">
<iframe scrolling="auto" height="100%" frameborder="0" width="100%" id="l_iframe" name="l_iframe" src="http://www.rubyonrails.com/" marginwidth="0" marginheight="0"></iframe>
</body>
</html>

原文地址:https://www.cnblogs.com/pkwblack/p/2953661.html