iframeを置くと
x=event.clientX;
y=event.clientY;
が取れません
どうやったら取れるのでしょうか?
<script> window.onmousemove=function(){ x=event.clientX; y=event.clientY; document.title=x+" "+y; } </script> <style> body,html{ height:100%; margin:0; } </style> <iframe style="width:100%;height:100%"></iframe>
<script> window.onload=function(){ document.getElementById("a").onmousemove=function(){ x=event.clientX; y=event.clientY; document.title=x+" "+y; } } </script> <style> body,html{ height:100%; margin:0; } </style> <iframe id="a" style="width:100%;height:100%"></iframe>
これ以外の方法はあるのでしょうか? <script> window.onload=function(){ document.getElementById('a').contentWindow.window.onmousemove=function(){ x=document.getElementById('a').contentWindow.window.event.pageX; y=document.getElementById('a').contentWindow.window.event.pageY; document.title=x+" "+y; } } </script> <style> body,html{ height:100%; margin:0; } </style> <iframe id="a" style="width:100%;height:100%"></iframe>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/12/01 21:16
2022/12/01 21:25