<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
type="text/javascript"></script>
<script
type="text/javascript">
$(function () {
$('#A_btn1').click(function () {
$('#A_txt').val($('#iframe1').contents().find('#B_txt').val());
});
$('#A_btn2').click(function () {
$('#iframe1').contents().find('#B_txt').val($('#A_txt').val());
});
});
</script>
<style
type="text/css">
body {
background: pink;
}
#iframe1 {
width: 300px;
height: 200px;
border: 0;
}
</style>
</head>
<body>
<form
id="form1"
runat="server">
<div>
<span>A</span><br />
<input type="text" id="A_txt"
/>
<input type="button"
id="A_btn1"
value="B to
A" />
<input type="button"
id="A_btn2"
value="A to
B" /><br />
<iframe
id='iframe1' src="Default2.aspx"></iframe>
</div>
</form>
</body>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
type="text/javascript"></script>
<script
type="text/javascript">
$(function () {
$('#B_btn1').click(function () {
parent.$("#A_txt").val($("#B_txt").val());
//$("#A_txt",
parent.document.body).val($("#B_txt").val());
});
$('#B_btn2').click(function () {
$("#B_txt").val(parent.$("#A_txt").val());
//$("#B_txt").val($("#A_txt", parent.document.body).val());
});
});
</script>
<style
type="text/css">
body {
background: yellow;
}
</style>
</head>
<body>
<form
id="form1"
runat="server">
<div>
<span>B</span><br />
<input type="text" id="B_txt"
/>
<input type="button"
id="B_btn1"
value="B to
A" />
<input type="button"
id="B_btn2"
value="A to
B" />
</div>
</form>
</body>
沒有留言:
張貼留言