EXECJAVASCRIPT()

From Lianjapedia
Revision as of 10:13, 28 March 2017 by Yvonne.milne (Talk | contribs)

Jump to: navigation, search

Purpose

Function to run multiple lines of JavaScript code

Syntax

EXECJAVASCRIPT(<expC>)

See Also

COMPILE, EXEC(), EXECPHP(), EXECPYTHON(), EXECSCRIPT()

Description

The EXECJAVASCRIPT() function runs multiple lines of JavaScript code. The lines of code are contained in <expC>, which can be a text constant, a filename, a character variable, or a character or memo field. The EXECJAVASCRIPT() function can handle blocks of code. Individual lines of code must be separated by a CHR(13) carriage return character. If a filename.js is specified it is loaded and executed.

Example

// Character field
create table if not exists scripts (script char(200))
if not used("scripts")
	use scripts
endif
select scripts
append blank
replace script with 'for (var i=0; i<11; i++)' + CHR(13) + '{';
 + CHR(13) + '// process commands;' + CHR(13) + '}' + CHR(13)
execjavascript(script)
 
// Text constant
execjavascript('for (var i=0; i<11; i++)' + CHR(13) + '{';
 + CHR(13) + '// process commands;' + CHR(13) + '}' + CHR(13))
 
// Memory variable
m_script = 'for (var i=0; i<11; i++)' + CHR(13) + '{';
 + CHR(13) + '// process commands;' + CHR(13) + '}' + CHR(13)
execjavascript(m_script)