简体   繁体   中英

How to include custom javascript function in Server Mobile Application HTML5 Builder

We are developing a Server Mobile Application, currently there are no server side implementation as yet.

I would like to use my own function on a Javascript MButton1JSClick event, like in the code below:

The question is, where do I put the actual function code for 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();

?>

Any help will be much appreciated, thanks.

You can define your JavaScript functions in a separated client unit (JavaScript file).

Documentation: Client Unit .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM