【问题标题】:How to make work Jquery on Java applet loaded inside specific portion of web page?如何在网页的特定部分加载Java小程序上的工作Jquery?
【发布时间】:2013-07-12 06:06:46
【问题描述】:

我是 jquery 和 javascript 的新手。

我在我的 html 页面中使用 jquery mousemove 函数编写了一些简单的功能。我想让 mousemove 在完整的文档(网页)上工作。

但是网页的特定部分在 iframe 中加载了 oracle 表单(因为它在 iframe 中运行 java,所以看起来像是在使用 applet 来加载 oracle 表单)。

问题: Jquery mousemove 函数在 iframe 中不起作用(但在网页的其他部分起作用)。如果我在 iframe 内移动鼠标,则不会执行 jquery 代码。

下面是完整的代码:

<BODY>

<iframe frameborder="0" style="height: 485px; overflow:scroll; width: 100%" src="http://209.34.231.132/forms/frmservlet?form=ClmRepymt_Dev4&config=dev4" marginheight="1" marginwidth="1" name="cboxmain" id="cboxmain" seamless="seamless" scrolling="no" frameborder="0" allowtransparency="true"></iframe>
<script src="jquery-1.10.2.min.js"></script>

<script>
var timer=0;

function run(){         
    timer++;    

    if(timer == 5){
        $(document).mousemove(function(){         
            $(this).unbind('mousemove');        
            $.ajax({
                url:     'http://localhost/test.html',
                cache:   false,
                data:    'html',
                success: function(data,status) {                       
                }
            });
            timer=0;                                    
        });

    }
}// run ends here

setInterval(run,1000); 
</script>
</BODY>  

即使我的鼠标在这个 iframe 部分内移动,是否有任何方法可以使我的相同代码工作?

我搜索了很多,但找不到这个问题的具体解决方案。

【问题讨论】:

标签: javascript jquery html applet


【解决方案1】:

那是不可能的。 iframe 本身就是一个完整的文档,并以相同的方式处理。除非您可以访问 iframe 代码,否则您无法从外部代码中捕获内部事件。在您的情况下,该代码不是。

其次,我想不出任何正当理由来检测鼠标悬停在 oracle iframe 上。也许您可以重新考虑方法/解决方案。或者你可以在这里分享你的想法,这里的人可能会帮助你实现它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-12
    • 1970-01-01
    • 2018-04-18
    • 1970-01-01
    • 2016-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多