Home  >  Article  >  Web Front-end  >  JQUERY code to set the SRC value of IFRAME_jquery

JQUERY code to set the SRC value of IFRAME_jquery

WBOY
WBOYOriginal
2016-05-16 18:15:031045browse
Copy code The code is as follows:

$(window.parent.document).find("#Frm_Main" ).attr("src",url);


Use jquery to operate iframe

1 There are two ifames in the content



jQuery in leftiframe changes the src code of mainiframe:
$(" #mainframe",parent.document.body).attr("src","http://www.jb51.net ")

2 If there is an ifame with the ID of mainiframe in the content
< ;iframe id="mainifame"...>
ifame contains a someID
you want to get this content

Get the contents of someID

$("#mainiframe").contents().find("someID").html() html or $("#mainiframe").contains().find("someID ").text() value

2 As shown above
jQuery in leftiframe operates the content of mainiframe and the content of someID
$("#mainframe",parent.document.body).contents ().find("someID").html() or $("#mainframe",parent.document.body).contents().find("someID").val()
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