Beste GoTers,
Ik zit sinds gisteravond met het probleem dat ik de 'onblur' en 'onfocus' niet aan iframe kan binden die een externe url laat zien (in FireFox, in IE werkt dit dus wél), als de src een url van de website zelf is werkt dit echt wel.
Ik krijg de volgende error:
( Ik weet dat het niet erg netjes is, en dat het vast mooier etc kan, maar ik ben geen JS pro oid )
Is er misschien een omweg hoe ik het wel zou kunnen laten werken?
Voorbeelden:
http://www.xurius.nl/example.html (Met tweakers.net iframe)
http://www.xurius.nl/example2.html (Met xurius.nl als iframe)
Ik zit sinds gisteravond met het probleem dat ik de 'onblur' en 'onfocus' niet aan iframe kan binden die een externe url laat zien (in FireFox, in IE werkt dit dus wél), als de src een url van de website zelf is werkt dit echt wel.
Ik krijg de volgende error:
Met deze code:Geen toestemming om eigenschap HTMLDocument.addEventListener te lezen
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
| <html>
<head>
<!-- JS -->
<script language="javascript">
var paused = 0;
function tClock( ) {
if( paused == '0' ) {
document.getElementById('status').innerHTML = 'UNPAUSED';
setTimeout( "tClock()", 1000 );
} else {
document.getElementById('status').innerHTML = 'PAUSED';
setTimeout( "tClock()", 100 );
}
}
function OnBlurFocus( ) {
if( document.all ) {
// IE
document.getElementById( 'ad' ).attachEvent( 'onblur', iFrameFixOnBlur );
document.getElementById( 'ad' ).attachEvent( 'onfocus', iFrameFixOnFocus );
window.attachEvent( 'onblur', WindowOnBlur );
window.attachEvent( 'onfocus', WindowOnFocus );
} else {
// FF - Dit werkt dus niet als de src een externe website is
document.getElementById( 'ad' ).contentDocument.addEventListener( 'blur', iFrameFixOnBlur, false );
document.getElementById( 'ad' ).contentDocument.addEventListener( 'focus', iFrameFixOnFocus, false );
window.addEventListener( 'blur', WindowOnBlur, false );
window.addEventListener( 'focus', WindowOnFocus, false );
}
}
function WindowOnBlur( ) {
paused = 1;
}
function WindowOnFocus( ) {
paused = 0;
}
function iFrameFixOnFocus( ) {
paused = 0;
}
function iFrameFixOnBlur( ) {
paused = 1;
}
function start( ) {
tClock( );
OnBlurFocus( );
}
</script>
<!-- /JS -->
</head>
<body onLoad="start( )" style="margin: 0;">
<!-- TOP -->
<div style="width: 100%;">
<div id="status">
</div>
</div>
<!-- /TOP -->
<!-- IFRAME -->
<div style="background: #FFF; width: 100%; height: 80%;">
<iframe src="http://www.tweakers.net" border="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%" id="ad"></iframe>
</div>
<!-- /IFRAME -->
</body>
</html> |
( Ik weet dat het niet erg netjes is, en dat het vast mooier etc kan, maar ik ben geen JS pro oid )
Is er misschien een omweg hoe ik het wel zou kunnen laten werken?
Voorbeelden:
http://www.xurius.nl/example.html (Met tweakers.net iframe)
http://www.xurius.nl/example2.html (Met xurius.nl als iframe)