如何在Server Mobile Application HTML5 Builder中包含自定义javascript函数

时间:2013-05-15 13:22:52

标签: html5builder

我们正在开发一个服务器移动应用程序,目前还没有服务器端实现。

我想在Javascript MButton1JSClick事件中使用我自己的函数,如下面的代码所示:

问题是,我在哪里放置myFunction()的实际功能代码

<?php
require_once("rpcl/rpcl.inc.php");
//Includes
use_unit("jquerymobile/forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
use_unit("jquerymobile/jmobile.inc.php");

//Class definition
class MPage1 extends MPage
{
    public $MButton1 = null;
    function MButton1JSClick($sender, $params)
    {
        ?>
        //begin js
            myFunction();
        //end
        <?php
    }
}

global $application;

global $MPage1;

//Creates the form
$MPage1=new MPage1($application);

//Read from resource file
$MPage1->loadResource(__FILE__);

//Shows the form
$MPage1->show();

?>

非常感谢任何帮助,谢谢。

1 个答案:

答案 0 :(得分:0)

您可以在单独的客户端单元(JavaScript文件)中定义JavaScript函数。

文档: Client Unit