在MSCRM中iframe无法disabled问题
1 var IFRAME_Test;
2 var IFRAME_Test_Disable_Message = "IFRAME Disabled
";
3
4 function OnCrmPageLoad() {
5 //Reference the IFRAME
6 IFRAME_Test = document.all.IFRAME_Test;
7 //Bind to its ready state event (wait until the iframe is fully loaded)
8 IFRAME_Test.attachEvent( "onreadystatechange" , OnTestIframeReady );
9 }
10
11 function OnTestIframeReady() {
12 if( IFRAME_Test.readyState != "complete" )
13 return;
14 //Override the onmousedown event
15 IFRAME_Test.contentWindow.document.onmousedown = OnTestIframeMouseDown;
16 }
17
18 function OnTestIframeMouseDown() {
19 alert( IFRAME_Test_Disable_Message );
20 /* or use */
21 //the window is put beyond the user's desktop and is immediately closed
22 var stubWin = window.open(‘about:blank’,’’,’ toolbars=0,width=100,height=100,top=10000,left=10000’);
23 stubWin.close();
24 return false;
25 }
26
27 //Entry point
28 OnCrmPageLoad();
2 var IFRAME_Test_Disable_Message = "IFRAME Disabled
![](https://www.cnblogs.com/Images/dot.gif)
3
4 function OnCrmPageLoad() {
5 //Reference the IFRAME
6 IFRAME_Test = document.all.IFRAME_Test;
7 //Bind to its ready state event (wait until the iframe is fully loaded)
8 IFRAME_Test.attachEvent( "onreadystatechange" , OnTestIframeReady );
9 }
10
11 function OnTestIframeReady() {
12 if( IFRAME_Test.readyState != "complete" )
13 return;
14 //Override the onmousedown event
15 IFRAME_Test.contentWindow.document.onmousedown = OnTestIframeMouseDown;
16 }
17
18 function OnTestIframeMouseDown() {
19 alert( IFRAME_Test_Disable_Message );
20 /* or use */
21 //the window is put beyond the user's desktop and is immediately closed
22 var stubWin = window.open(‘about:blank’,’’,’ toolbars=0,width=100,height=100,top=10000,left=10000’);
23 stubWin.close();
24 return false;
25 }
26
27 //Entry point
28 OnCrmPageLoad();
请参看:戈雅论坛