Jquery method for obtaining the iframe src attribute value, jqueryiframe

Source: Internet
Author: User

Jquery method for obtaining the iframe src attribute value, jqueryiframe

Get the value of the iframe src attribute:

Html code

<!DOCTYPE HTML> 

How does js obtain its own iframe attribute?

Var tableName = window. parent. frames ["mainFrame"]. tName; // get the parameter value of the parent page
Window. parent. frames ["mainFrame"]. getPageInfo (); // method of the parent page
Var divValue = window. parent. $ ("# test"). text (); (jQuery); // obtain the text value of the parent page div
Var htmlUrl = window. parent. $ ("# main_frame"). attr ("src"); (jQuery) // obtain the src attribute value of iframe on the parent page

You are var id = window. parent. frames [0]. id;
 
How does jQuery assign values to the src of iframe?

Assume that the id of your iframe is "iframeId" and the value to be assigned is value.

<Script type = "text/javascript">

$ (Function (){
$ ("# IframeId"). attr ("src", value );
});

</Script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.