小惡魔AppleBOY
AppleBOY
小惡魔 - 電腦技術 - 工作筆記 - AppleBOY is about »
tag cloud
- ajax
- amazon
- amd
- android
- angularjs
- apache
- apc
- api
- appfog
- aws
- backboe event
- backbone.js
- bitbucket
- blog
- boilerplate
- boot
- bootloader
- bower
- browser
- busybox
- c
- c#
- c++
- cakephp
- capistrano
- centos
- chrmoe
- chrome
- ckeditor
- code style
- codeigniter
- coffeescript
- compass
- compass css framework
- conference
- css
- css3
- debian
- denyhost
- django
- driver
- eaccelerator
- editorconfig
- emacs
- embedded system
- error
- excel
- express
- fabric
- fancybox
- fanout
- fanterm
- fastcgi
- fckeditor
- fedora
- firebug
- firefox
- firefox os
- firephp
- flickr
- forefox os
- framework
- freebsd
- friefox
- fuse
- gae
- gaia
- galera
- geany
- git
- git hooks
- github
- gmail
- google api
- google app engine
- google extension
- google web toolkit
- grub
- grub2
- grunt
- gruntjs
- haproxy
- html
- html5
- i18n
- icos
- ie
- innodb
- iphone
- javascript
- javascrpt
- jquery
- jquery migrate plugin
- jquery mobile
- jsdc
- json
- kernel
- laravel
- life
- lighttpd
- linode
- linux
- linux kernel
- live.js
- livereload
- mariadb
- mobile
- mobile web
- mod_rpaf
- modern.ie
- mount
- mp3
- mssql
- myisam
- mysql
- network
- nexmo
- nginx
- nodejs
- normalize.css
- npm
- nvm
- osdc
- ossf
- pagoda
- pdo
- percona
- performance
- perl
- php
- php-cs-fixer
- php-fig
- php-fpm
- phpbb
- phpbb3
- phpconf
- phpfog
- plurk
- plurk api
- png
- ports
- prgmr
- proftpd
- proxy
- pushstate
- python
- rackspace
- refactor
- requirejs
- responsive design
- rhel
- ruby
- rubygems
- sass
- sencha
- sencha touch
- send-pr
- slicehost
- sms
- spdy
- sphinx
- spinejs
- sql
- squid
- sqwish
- ssh
- sshfs
- svn
- textmagic
- titanium
- titanium mobile
- touch
- twitter bootstrap
- ubuntu
- uderscore.js
- uglifyjs
- underscore.js
- usb
- varnish
- vim
- virtualbox
- vps
- windows
- wordpress
- www
- xcache
- xdebug
- xtrabackup
- yasnippet
- zend framework
- 中正大學
- 剪頭髮
- 好站連結
- 心情日記
- 拉斐爾廚房
- 旅行日記
- 樹太老
- 版本控制
- 生活日記
- 網頁重構
- 美食
- 美食日記
- 虛擬主機
- 謝師宴
- 音樂分享
- 騰訊
- 高雄美食
» [筆記] iframe 父頁子頁呼叫函式 parent call function
紀錄 iframe 如何呼叫子頁或者是父頁函式,iframe 在現今 Web 2.0 時代已經不流行了,因為有很多問題的存在,例如對於 SEO 搜尋引擎也沒有幫助,但是也是很多人在使用,底下筆記心得,說不定之後會 google 到自己的文章,哈哈。
父頁(主視窗)呼叫子頁函式:
/* iframeID 是 iframe ID*/
window.iframeID.formSubmit();
/* ifr 是 iframe ID */
document.getElementById('ifr').contentWindow.formSubmit();
window.iframeID.formSubmit();
/* ifr 是 iframe ID */
document.getElementById('ifr').contentWindow.formSubmit();
子頁(iframe)呼叫父頁(主視窗)函式:
parent.formSubmit();
如果有兩層
parent.parent.formSubmit();
注意 timing issue,等 iframe 視窗 load 完之後才可以呼叫 iframe function。至於如果取主視窗跟 iframe 的變數 value,可以利用 jQuery $(”#ID”) 方式來得到。
reference:
【程式】JS : parent , iframe function call
Access child function from iframe
Related View
- [jQuery] 解決 IE6 PNG 透明背景 (Supersleight jQuery Plugin for Transparent PNGs in IE6) (2)
- [jQuery] AjaxFileUpload : Multiple File Upload plugin (5)
- [CSS] IE 6, 7, 8 FireFox hack 支援透明背景圖 background or img javascript (2)
- Google Chrome 支援超過 40,000 Extensions! with Greasemonkey (1)
- Using firebug for firefox 除錯 javascript (1)
- [Javascript] 在函數裡設定參數預設值 (0)
- [jQuery] ThickBox 3.1 無限期停止支援維護 (0)
- [jQuery] 驗證表單實作筆記 API/1.3/Selectors (0)
- [網站] 好站連結 (三) (0)
- 使用 CSS 排版製作網站 (2)









