从iframe调用函数

时间:2016-01-08 07:12:18

标签: php wordpress variables iframe

我使用隐藏的iframe作为目标来上传文件...从这个iframe中我想运行一个在我的主页上的函数。

在我的目标iframe.php中,我有

<script>

upload_completed(<?php echo $numerolinha ?>); 
    </script>

但是我从萤火虫那里得到了:

ReferenceError: loading_linha_21 is not defined
parent.upload_completed();</script>

如果我在我的主页面上运行upload_completed(loading_linha_21);它运行正常,所以我猜测在父页面上运行该功能的命令不起作用...帮助!

我也尝试过:

window.top.upload_completed(<?php echo $numerolinha ?>); 

window.upload_completed(<?php echo $numerolinha ?>);

我的职能:

 <script >
 function upload_started(id){

  $(id).css("display","block");
 }
 function upload_completed(id){
 $(id).css("display","none");
 }


 </script>

2 个答案:

答案 0 :(得分:1)

我能给你的最好的猜测是jQuery函数要求id为#name_of_id,所以当你从iframe调用函数时如下:

parent.upload_completed('#<?php echo $numerolinha ?>');

或者你可以改变你的功能来做到这一点:

function upload_started(id){
    $( '#' + id).css("display","block");
}

function upload_completed( id ) {
    $( '#' + id ).css("display","none");
}

答案 1 :(得分:0)

javax.net.ssl.SSLException: Received fatal alert: <UNKNOWN ALERT: 194> javax.net.ssl.SSLException: Received fatal alert: bad_certificate javax.net.ssl.SSLHandshakeException: Received fatal alert: insufficient_security javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake failure javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate expired javax.net.ssl.SSLHandshakeException: Received fatal alert: export_restriction javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unobtainable 放在内部函数中,如下所示:

'