this solve my problem perfectly
来源:互联网 发布:java 跳出for循环 编辑:程序博客网 时间:2024/06/05 08:18
i struggled with this problem 4days ,and i solve it from here:
http://bbs.csdn.net/topics/390878194
1.在加载完后再执行
2.是button.onclick=function(),不是button.click=function()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>a</title>
<script type=
"text/javascript"
>
function
alert_(){
var
iframe=document.getElementById(
"frame"
).contentWindow;
alert(iframe.document.getElementById(
"div"
).innerHTML);
}
function
update_(){
var
iframe=document.getElementById(
"frame"
).contentWindow;
iframe.document.getElementById(
"div"
).innerHTML=
"七上八下"
;
}
function
doit(){
//给b页面绑定点击事件 这里为什么不行呢。。。 求解决
var
button=document.getElementById(
"frame"
).contentWindow.document.getElementById(
"button2"
);
button.onclick=
function
(){
alert(
"555555555"
);
}
}
</script>
</head>
<body onload=
"doit()"
>
<div>
<input type=
"button"
value=
"弹出iframe中div的值"
onclick=
"alert_()"
id=
"button1"
/>
<input type=
"button"
value=
"修改iframe中div的值"
onclick=
"update_()"
/>
</div>
<iframe src=
"b.html"
frameborder=
"1"
width=
"600"
height=
"100"
style=
"border:#F00"
id=
"frame"
/>
</body>
</html>
子窗口:b.html
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/>
<
title
>b</
title
>
</
head
>
<
body
>
<
input
type
=
"button"
id
=
"button2"
value
=
"修改a中的弹出按钮的值"
/>
<
div
id
=
"div"
style
=
" border:1px solid yellow;"
>乱七八糟</
div
>
</
body
>
</
html
>
1
2
3
4
5
6
7
8
9
<iframe src=
"b.html"
frameborder=
"1"
width=
"600"
height=
"100"
style=
"border:#F00"
id=
"frame"
/>
<script type=
"text/javascript"
>
var
button=document.getElementById(
"frame"
).contentWindow.document.getElementById(
"button2"
);
button.onclick=
function
(){
alert(
"555555555"
);
}
</script>
</body>
阅读全文
0 0
- this solve my problem perfectly
- Solve this interesting problem
- H - Solve this interesting problem
- HDU5323.Solve this interesting problem
- HDU 5323 Solve this interesting problem
- HDU 5323 SOLVE THIS INTERESTING PROBLEM 爆搜
- 【搜索】 HDU 5323 Solve this interesting problem
- HDU 5323 Solve this interesting problem(暴搜)
- HDU5323 Solve this interesting problem 暴力DFS
- hdu 5323 Solve this interesting problem 【DFS】
- 多校赛3- Solve this interesting problem
- 2015多校Solve this interesting problem
- hdu 5323 Solve this interesting problem
- HDU 5323 Solve this interesting problem(DFS)
- HDU 5323Solve this interesting problem(DFS)
- How to solve this problem oC
- Hdu 5323 Solve this interesting problem【Dfs】
- SRM 437 TheBeauty (three ways to solve this problem)
- 数据结构第四周项目2--建设“单链表”算法库
- H5页面加载另一个页面的问题
- Java中判断List为空
- sql语句调优
- 常见JedisConnectionException异常分析
- this solve my problem perfectly
- 深度学习中的Dropout原理介绍
- day7下
- linux学习第十七篇:vim介绍,颜色显示,移动光标,复制剪切粘贴
- 贪心算法——会场安排问题
- Python的复制
- @responseBody注解的使用
- 在linux下安装php扩展时,找不到configure
- 繁花规小程序~