<script type="text/javascript">
//-------------------------------------------------------------------------------------------
//index.templete.html中写这个javaScript
// Specifies a function for the window's onbeforeunload event
// Call back to the getUnsavedDataWarning in our Flex app when the browser is about to unload
//-------------------------------------------------------------------------------------------
//window.onbeforeunload = function()
window.onbeforeunload = onbeforeunload_handler;
function onbeforeunload_handler()
{
var warning="";
var fxControl = document.${application} || window.${application};
if ( fxControl )
if ( typeof fxControl.getUnsavedDataWarning=="function")
warning = fxControl.getUnsavedDataWarning(); // This calls a function in our Flex app
//if ( typeof fxControl.getName=="function") //getName是你注册的回调函数 ,判断是否是一个function是就调用
// warning = fxControl.getName(); // This calls a function in our Flex app
if ( warning != '' )
return warning;
else
return void(0);
}
// Specifies a function for the window's onunload event
// Call back to the javascriptOnUnload in our Flex app when the browser unloads
window.onunload = function()
{
var fxControl = document.${application} || window.${application};
if ( fxControl )
if ( typeof fxControl.javascriptOnUnload=="function")
fxControl.javascriptOnUnload(); // This calls a function in our Flex app
}
mxml中注册回掉函数
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private const UNSAVED_DATA_WARNING:String = 'You have unsaved changes. You will lose them if you continue.';
private function onCreationComplete():void {
onClick();
ExternalInterface.addCallback("getUnsavedDataWarning",
function():String {
return UNSAVED_DATA_WARNING;
}
);
}
private function onClick(){
ExternalInterface.addCallback("getName",getName); //注册,第2个参数是function
}
public function getName(){
mx.controls.Alert.show("js调用");
return "nihoa"
}
]]>
</mx:Script>
</mx:Application>
Process migration from tomcat to websphere changes Because customers use the web application server software used by different what tomcat5, tomcat6, websphere5.1, websphere6.1, weblogic8, and so on, ...
dsfdsa http://lindows.javaeye.com/admin/blogs/213348 Tomcat 6 with the connection pool data source configuration http://www.blogjava.net/ec2008/archive/2008/07/19/216063.html project: test Driver path ...
EJB3 persistence with Hibernate is very similar to the mechanism: Environment: Server: JBOSS5.0 Database: MySQL5.0 1. Set up a data source First of all, in jboss-5.0.0.GA \ server \ default \ deploy, ...
Servlet brief introduction: Servlet is a small application server Are used to complete the B / S architecture, the client requests the response to treatment Platform independence, performance, able to ...