-
Notifications
You must be signed in to change notification settings - Fork 0
/
L9.7.html
47 lines (45 loc) · 1.55 KB
/
L9.7.html
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
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
function catchEvent(eventObj,event,eventHandler){
if(eventObj.addEventListener){
eventObj.addEventListener(event,eventHandler,false);
}else if(eventObj.attachEvent){
event = "on" + event;
eventObj.attachEvent(event,eventHandler);
}
}
catchEvent(window,"load",function(){
catchEvent(document.forms[0],"click",colorChange);
})
function colorChange(){
var colors = document.forms[0].color;
var result = document.getElementById('result');
for(var i = 0;i < colors.length;i++){
if(colors[i].checked){
var myFrame = document.getElementById("myFrame");
myFrame.contentWindow.location.href="service.php?color=" +colors[i].value;
myFrame.onload= function(){
result.innerHTML = myFrame.contentWindow.document.getElementById("va12").innerHTML;
}
}
}
}
</script>
</head>
<body>
<div>
<form action="">
<p>
<input type="radio" name="color" value="red">red<br/>
<input type="radio" name="color" value="blue">blue<br/>
</p>
</form>
</div>
<iframe name="myframe" id="myframe" style="width: 0;height: 0;border: 0" src="service.php"></iframe>
<div id="result"></div>
</body>
</html>