#站点端
<form action="{{ url_for('main.tmps',path=jupyter.record_file) }}" method="post" id="jiaoben"></form>
<div class="code">
<iframe id="iframe1" src="{{ jupyter.template_url}}" width="100%" height="900px"></iframe>
</div>
<script>
var messenger = new Messenger('parent', 'MessengerDemo'),
iframe1 = document.getElementById('iframe1'),
input = document.getElementById('message');
messenger.listen(function () {
//var newline = '\n';
//var text = document.createTextNode(msg + newline);
document.getElementById('jiaoben').submit();
//document.getElementById('output').appendChild(text);
});
</script>
#jupyter端
<div id="maintoolbar" class="navbar">
<div class="toolbar-inner navbar-inner navbar-nobg">
<div id="maintoolbar-container" class="container">
<script>
//alert(12313);
window.onload=function()
{
var temp=document.getElementById('save-notbook');
var ipt=temp.getElementsByTagName('button');
var messenger = new Messenger('iframe1', 'MessengerDemo');
messenger.addTarget(window.parent, 'parent');
ipt[0].onclick= function () {
//alert(123);
messenger.targets['parent'].send("message from iframe1: click" );
//alert(123123);
};
/*ipt[0].onclick=function ()
{
alert('jump all');
};*/
}
</script>
</div>
</div>
</div>
</div>