Click here to Skip to main content
13,093,720 members (61,339 online)
Rate this:
Please Sign up or sign in to vote.
i have a asp page that contains linkButtons and one iframe
i want to do this, when user clicked on buttons, the "src" attribute of iframe change and then the content of destination loaded to iframe, and when the iframe is loading,
the loading show to user, this my asp page

<head id="Head1"  runat="server">
    <script type="text/javascript" src=""></script>
    <style type="text/css">
        #container, #container iframe {
            position: relative;
            width: 800px;
            height: 500px;
        #loading {
            position: absolute;
            width: 100%;
            height: 100%;
            display: none;
            background-color: rgba(160, 160, 160, 0.6);
            color: White;
            top: 0;
            right: 0;
            text-align: center;
            font-family: Tahoma;
        #InnerLoading {
            display: none;
            color: white;
            margin-top: 200px;
    <script type="text/javascript">
        $(function () {
            $('a.framesLinks').click(function (){
                var frame1 = document.getElementById('frame1');
                var loadingDisplay = document.getElementById('loading').style;
                loadingDisplay.display = 'block';
                var innerLoading = document.getElementById('InnerLoading').style;
                innerLoading.display = 'block';
                if (frame1.onload == null) {
                    frame1.onload = function () {
                        loadingDisplay.display = 'none'
                        innerLoading.display = 'none'
                    if (window.attachEvent) {
                        frame1.attachEvent('onload', frame1.onload);
                if (fram.onload != null) {
                    loadingDisplay.display = 'block';
                    innerLoading.display = 'block';
                return true;
    <form id="form1" runat="server">
    <table align="center">
                <a class="framesLinks" href="" target="frame1">ASP.NET</a>
                <a class="framesLinks" href="" target="frame1">Google</a>
                <a class="framesLinks" href="" target="frame1">Yahoo</a>
                <div id="container">
                    <iframe class="FrameFrame" id="frame1" name="frame1" src="about:blank" scrolling="auto" frameborder="1" ></iframe>
                    <table align="center">
                                <div id="loading">
                                    <div id="InnerLoading">
                                        <span dir="rtl">در حال بارگزاری . . .<br />
                                        <img src="Loading Image.gif" alt="Loading . . ." />

it's work fine, but when the iframe refresh/reload it's doesn't work
because the JavaScript function is set to the click event of linkButtons
but i'm want to shown image to user when iframe are refresh.
Posted 27-Nov-12 23:20pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100