/
simple.html
64 lines (64 loc) · 2.23 KB
/
simple.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh-tw">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Cross Frame Prototype</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssfonts/fonts-min.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssbase/base-min.css">
<style type="text/css">
body {
padding: 10px;
}
h1 {
margin: 20px 0;
font-family: Georgia;
font-weight: bold;
}
iframe {
border: solid 3px #ccc;
position: fixed;
top: 10px;
right: 10px;
*position: absolute;
}
textarea {
width: 500px;
height: 200px;
}
</style>
<script type="text/javascript" src="yui-debug-fix.js"></script>
<script type="text/javascript" src="crossframe.js"></script>
<script type="text/javascript">
YUI().use("crossframe", "json-stringify", function (Y) {
var formNode = Y.one("form");
formNode.on("submit", function (e) {
e.preventDefault();
var frameName = "frames['simple-iframe']",
message = formNode.one("textarea").get("value"),
config = {
"proxy" : "http://josephjiang.com/project/yui3-crossframe/proxy.html",
"reverseProxy": "http://josephj.com/project/yui3-crossframe/proxy.html",
"eventType" : "crossframe:test1",
"callback" : function (o) {
alert(o.info);
}
};
Y.CrossFrame.postMessage(frameName, message, config);
});
});
</script>
</head>
<body>
<h1>Y.CrossFrame Simple Example</h1>
<p>
Current Location:
<a href="http://josephj.com/project/yui3-crossframe/simple.html">http://josephj.com/project/yui3-crossframe/simple.html</a>
</p>
<form>
<textarea>Hello World</textarea><br>
<input type="submit" value="Submit">
</form>
<iframe src="http://josephjiang.com/project/yui3-crossframe/simple-iframe.html" id="simple-iframe" name="simple-iframe" width="500" height="500" border="3" frameborder="3"></iframe>
</body>
</html>