In addition to understanding basic content controls, form controls, and layout controls, it is more important to master the scripting features when using mobile app development with love code. Scripting is essential for interaction and invocation between interfaces, making full use of the scripting features that make apps move rather than simply static pages.
The following is a brief introduction to the global approach Http://www.imagapp.com/doc/global in scripting, and the global approach mainly includes the following sections.
$ (id:string); Get Control Object
var button = $ (' Test_button ');
$C (xml:string); through XML To create a control object
var button = $C (' <button id= ' Test_button ' > button </button> '); For Listitemvar ListItem = $C (' <list-item><item href= ' detail.xml ' ><label> text content </label></ Item></list-item> ');//for Griditemvar GridItem = $C (' <grid-item><item href= ' detail.xml ' >< label> text content </label></item></grid-item> ');
alert (text:string); Prompt Box
<button onclick= "alert (' Exit login ')" > Click button </button>//as long as the control with the OnClick property can be used
alert (title|text:string); Cue box (with caption)
<button onclick= "alert (' Exit Login | exit ') ' > click button </button>
Confirm (title|text:string); Confirmation Box (with title)
<?xml version= "1.0" encoding= "Utf-8"?><imag> <script> <![ cdata[ function testconfirm () { if (confirm (' Exit login | ok? ') { hint (' OK '); } else { hint (' Cancel '); } ]] > </script> <page> <title style= "background: #acacac" > <center> <label> Global Methods </label> </center> </title> <content draggable= "true "> <button onclick=" testconfirm () "> Click button </button> </content> </page> </imag>
Full Code Https://github.com/imagjs/Global-method/blob/master/index.xml
imag.js| Fast Mastering the global Approach