r1 - 04 Aug 2005 - 11:22:55 - JonPriddeyYou are here: TWiki >  Main Web  >  ElixirReport > ElixirReportCookbook > JavaScriptSubstitution

JavaScript substitution

JavaScript can be embedded in literal text by using variable substitution syntax where the first character is an equals "=" sign. For example,

Today is ${=new java.util.Date()}

will embed today's date into the field. The alternative is to declare the field with a script source:

"Today is " + new java.util.Date();

Both variants are equivalent in terms of performance and result, however the ${=...} syntax can be used anywhere a variable substitution is allowed, for example in a URL:

http://www.localhost.com/error-${=getYMD()}.log

where getYMD is a JavaScript function you have written to return a string of the form 20050804 thus forming a URL http://www.localhost.com/error-20050804.log

-- JonPriddey - 04 Aug 2005

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback