Hi all;
I want to communicate between ManagedIFramePanel and embedded iframe;
Anyone could tell me how to do it?
Fllowing is my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test Iframe</title>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
<!-- LIBS -->
<script type="text/javascript" src="../js/core/adapter/ext-base.js"></script>
<script type="text/javascript" src="../js/core/ext-all.js"></script>
<!-- Test extensions -->
<script type="text/javascript" src="../js/extensions/Ext.ux.ManagedIFrame.js"></script>
<script type="text/javascript" src="../js/extensions/mifmsg.js"></script>
<script type="text/javascript" src="ts-iframe.js"></script>
</head>
<body>
<div id="test-iframe"></div>
</body>
</html>
javascript is(ts-iframe.js):
Ext.ux.TestIframePanel = Ext.extend(Ext.ux.ManagedIFramePanel, {
initComponent: function(){
this.tbar = [{
text: 'Send',
scope: this,
handler: function(){
this.fireEvent('send');
}
}];
Ext.ux.TestIframePanel.superclass.initComponent.call(this);
this.addEvents('send', 'receive');
},
initEvents: function(){
Ext.ux.TestIframePanel.superclass.initEvents.call(this);
this.on('send', function(){
alert('I want to send message to embedded page: test.html');
}, this);
this.on('receive', function(){
alert('I want to receive message from embedded page');
});
}
});
Ext.onReady(function(){
Ext.QuickTips.init();
var iframePanel = new Ext.ux.TestIframePanel({
defaultSrc: 'test.html',
disableMessaging: false,
renderTo: 'test-iframe',
width: 600,
height:400
});
});
The embedded page is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="expires" content="Mon, 22 Jul 2002 11:12:01 GMT">
<script language="javascript">
function send(){
//I want to send message to TestIframePanel
}
function receive(message){
//I want to receive message from TestIframePanel here!
document.getElementById('logger').innerHTML = message.data;
}
</script>
</head>
<body text="#000000" bgcolor="#ffffff" link="#00000" vlink="#00000">
<a href="javascript:send();">Send Message to TestIframePanel</a><br />
<div id="logger"></div>
</div>
</body>
</html>
Thanks a lot!
分享到:
相关推荐
Real-time and embedded systems are essential to our lives, from controlling car engines and regulating traffic lights to monitoring plane takeoffs and landings to providing up-to-the-minute stock ...
Pic Microcontroller And Embedded Systems
《Design-For-Test For Digital IC's and Embedded Core Systems》是一本专为IC设计的研究生、博士生以及工程师量身打造的经典著作,深入探讨了数字集成电路(Digital IC)的可测性设计(DFT,Design-for-Test)以及...
《Hands-On Mobile and Embedded Development with Qt5》是一本专注于使用Qt5框架进行移动和嵌入式设备开发的实践指南。Qt5是一个强大的跨平台应用程序开发框架,它支持多种操作系统,包括Android、iOS、Linux以及...
There are many books on project management and many on embedded systems, but few address the project management of embedded products from concept to production. Project Management of Complex and ...
Verifying nonvolatile memory contents with CRCs * Interfacing to on-chip and external peripherals * Device driver design and implementation * Optimizing embedded software for size and ...
Understand the key differences between PC and embedded ecosystems in terms of firmware needs. Thorough underpinning of Intel’s firmware solutions. How to build a firmware stack for Quark. How to ...
based UI platform, which is capable of handling large-scale data-driven business applications for PC as well as mobile and embedded devices. The expert authors cover the new more modular JavaFX 9 APIs...
Learn to design and develop safe and reliable embedded systems Key Features Identify and overcome challenges in embedded environments Understand the steps required to increase the security of IoT ...
<br> <br>Hallinan begins by touring a typical Linux-based embedded system, introducing key concepts and components, and calling attention to differences between Linux and traditional embedded ...
### Yocto Project 和 OpenEmbedded 培训知识点解析 #### Yocto 项目简介 Yocto 项目是一个开源项目,旨在为嵌入式 Linux 提供一个灵活、可重复且可靠的开发框架。通过 Yocto 项目,开发者能够创建自定义的 Linux ...
If you\'re new to this and don\'t know what a MAXQ is, don\'t worry--the book spells out the basics of embedded design for beginners while providing material useful for advanced systems designers. ...