JS方法在iframe父子窗口間的調(diào)用
作者:admin
JavaScript是屬于網(wǎng)絡(luò)的腳本語(yǔ)言!JS中有很多值得學(xué)習(xí)的方法,這里看一下iframe父子窗口間JS方法的調(diào)用,相信本文介紹一定會(huì)讓你有所收獲,歡迎大家一起來(lái)學(xué)習(xí)JS方法。
本文向大家簡(jiǎn)單介紹一下iframe父子窗口間JS方法調(diào)用,JavaScript 被數(shù)百萬(wàn)計(jì)的網(wǎng)頁(yè)用來(lái)改進(jìn)設(shè)計(jì)、驗(yàn)證表單、檢測(cè)瀏覽器、創(chuàng)建cookies,以及更多的應(yīng)用,希望本文介紹對(duì)你有所幫助。
iframe父子窗口間JS方法調(diào)用
父窗口調(diào)用iframe子窗口方法
- <iframenameiframename="myFrame"src="child.html">
- </iframe>
- myFrame.window.functionName();
iframe子窗口調(diào)用父窗口方法
- parent.functionName();
父窗口頁(yè)面
- <html>
- <head>
- <scripttypescripttype="text/javascript">
- functionsay(){
- alert("parent.html------>I'matparent.html");
- }
- functioncallChild()
- {
- //document.frames("myFrame").f1();
- myFrame.window.say();
- }
- </script>
- </head>
- <body>
- <inputtypeinputtype=buttonvalue="調(diào)用child.html中的
- 函數(shù)say()"onclick="callChild()">
- <iframenameiframename="myFrame"src="child.html"></iframe>
- </body>
- </html>
子窗口頁(yè)面
- <html>
- <head>
- <scripttypescripttype="text/javascript">
- functionsay()
- {
- alert("child.html--->I'matchild.html");
- }
- functioncallParent(){
- parent.say();
- }
- </script>
- </head>
- <body>
- <inputtypeinputtype=buttonvalue="調(diào)用parent.html中的
- say()函數(shù)"onclick="callParent()">
- </body>
- </html>
【編輯推薦】
- 探究?jī)煞NJS浮點(diǎn)溢出解決方案
- JavaScript fixed()方法語(yǔ)法淺析
- IE6.0中使用Javascript支持png格式圖片
- Javascript中CSS屬性float特殊寫法
- Javascript巧妙解決img做網(wǎng)站異常提交問(wèn)題
責(zé)任編輯:佚名
來(lái)源:
firnow.com