Home >Web Front-end >JS Tutorial >Sharing examples of interoperability between frames using jQuery

Sharing examples of interoperability between frames using jQuery

小云云
小云云Original
2018-01-06 10:17:531380browse

This article mainly introduces the method of jQuery to realize the intercommunication between frames, and analyzes the method of jQuery to realize the calling operation between the parent and child frames in the form of examples. Friends who need it can refer to it. I hope it can help everyone.

Parent frame:


// 需要共享的方法
function veriAddData(varname,vardesc){
  var name = varname;
  var desc = vardesc;
  if(name!==""&&desc!==""){
    doAdd(name,desc);
  }
}
// 如何共享
if ( $.browser.msie&&+$.browser.version<8 ){//低于ie8的浏览器处理
    //ie,先未处理
    document.frames["url"].window["veriAddData"] = window["veriAddData"];
}else{ // url为子框架的id
    $("#url")[0].contentWindow["veriAddData"] = veriAddData;
}

Child frame:

// 如何调用父框架的方法
parent.veriAddData($("#varName").val(),$("#varDesc").val());

Related recommendations:
PHP uses iframe to upload images Display

jquery and iframe make an ajax upload effect example sharing

Using JQuery to operate iframe parent page and child page method summary

The above is the detailed content of Sharing examples of interoperability between frames using jQuery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn