This time I will bring you the call to the iframe page based on the ID (with code). What are the precautions for calling the iframe page based on the ID? The following is a practical case, let's take a look.
$(window.parent. document ).contents().find("#iframeID")[0].contentWindow.initPagerList();
Description:
iframeID is the ID of the iframe; initPagerList is the method in the iframe page.<html> <head> <title></title> <script> $(function(){ /* 说明: iframeID 为iframe的ID; initPagerList 为 iframe 页面内的方法。 */ //调用iframe页面iframeID中的initPagerList方法 $(window.parent.document).contents().find("#iframeID")[0].contentWindow.initPagerList(); //获取iframe页面iframeID中的文本框txtControlID对象 var txtControlObj=$(window.parent.document).contents().find("#iframeID")[0].contentWindow.find("#txtControlID"); //为iframe页面iframeID中的文本框txtControlID赋值 txtControlObj.val("我就是你需要设置的内容值!"); }); </script> </head> <body> </body> </html>
jquery js calls the iframe parent window and child window Detailed explanation of steps
The above is the detailed content of Call the iframe page based on ID (code attached). For more information, please follow other related articles on the PHP Chinese website!