javascript iframe内的函数调用实现方法
作者:bea
sxmsxm.html 代码如下: <script> function sonfun() { alert('ok'); } </script> main.html 代码如下: <iframe id="sxm" src="sxmsxm.html" width='100' height='100'></iframe> 在main.html中执行 sxmsxm.html中的sonfun() 有两种方式 1、 sxm.son
sxmsxm.html
代码如下:
<script> function sonfun() { alert('ok'); } </script>
main.html
代码如下:
<iframe id="sxm" src="sxmsxm.html" width='100' height='100'></iframe>
在main.html中执行 sxmsxm.html中的sonfun() 有两种方式
1、 sxm.sonfun()
2、document.getElementById("sxm").contentWindow.sonfun();
有用 | 无用
代码如下:
<script> function sonfun() { alert('ok'); } </script>
main.html
代码如下:
<iframe id="sxm" src="sxmsxm.html" width='100' height='100'></iframe>
在main.html中执行 sxmsxm.html中的sonfun() 有两种方式
1、 sxm.sonfun()
2、document.getElementById("sxm").contentWindow.sonfun();
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- javascript Base类 包含基本的方法
- 从基础开始建立一个JS代码库
- javascript FAQ函数(提问+回复)
- javascript 表单规则集合对象
- javascript ImgBox透明遮罩层背景图片展示
- JavaScript 进度条实现代码(Firefox等相似浏览器下不支持)
- javascript 三级下拉选择菜单Levels对象
- 一个可以随意添加多个序列的tag函数
- 一个cssQuery对象 javascript脚本实现代码
- js计算页面刷新的次数
- [原创]IE view-source 无法查看看源码 JavaScript看网页源码
- Prototype Hash对象 学习
- Prototype Array对象 学习
- Prototype PeriodicalExecuter对象 学习
- Prototype Enumerable对象 学习
- Prototype Number对象 学习
- Prototype ObjectRange对象学习
- Prototype RegExp对象 学习
- Prototype Class对象学习