Jan 24

Mousedown event for FireFox and IE. 

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>MouseDown in IFrame works both in IE and FF</title>
    <script>
      // Global Variables
      function SetMouseDown( )
      {
            // Variables
            var intIndex = 0;
            var ifraCurrent = null;
           
            var framesInner=document.getElementsByTagName("iframe");
            // Loop through frames
            for( intIndex = 0; intIndex < framesInner.length; intIndex++ )
            {
                  // Get a reference to the current target
                  ifraCurrent = framesInner[ intIndex ];
                  ifraCurrent.contentWindow.document.designMode="on";
                  ifraCurrent.contentWindow.document.onmousedown = new Function( "onIMouseDown( '" + ifraCurrent.name+ "' )" );

            }
      }

      function onIMouseDown( strTarget )
      {
            alert( strTarget );
      }
    </script>

</head>
      <body onload="SetMouseDown( );">

            <iframe name="ifraMain1" src="Test2.html"></iframe>
            <iframe name="ifraMain2" src="Test2.html"></iframe>
            <iframe name="ifraMain3" src="Test2.html"></iframe>
      </body>

</html>

Tags: |

Comments

Add comment


 

  Country flag

biuquote
  • Comment
  • Preview
Loading