You are not logged in.

#1 2016-11-09 19:11:00


Where to place external Javascript code in our applications

Hi, i added this code in content html control and got Error: "'myMove' is undefined" ,
is there any way to call a function is defined in html?
thanks !

<!DOCTYPE html>
#myContainer {
  width: 400px;
  height: 400px;
  position: relative;
  background: yellow;
#myAnimation {
  width: 50px;
  height: 50px;
  position: absolute;
  background-color: red;

<button onclick="myMove()">Click Me</button>

<div id ="myContainer">
<div id ="myAnimation"></div>

function myMove() {
  var elem = document.getElementById("myAnimation");
  var pos = 0;
  var id = setInterval(frame, 10);
  function frame() {
    if (pos == 350) {
    } else {
      pos++; = pos + 'px'; = pos + 'px';


Last edited by starin (2016-11-09 19:11:45)

#2 2016-11-09 19:20:23

From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,718

Re: Where to place external Javascript code in our applications

Hello starin,

You must place the Javascript code in some app's/view's/control's event (between the couple "StartJS" and "EndJS" actions) or in an external Javascript file or maybe in an app's Javascript function. Depending on where you place it then you can use it in some or other way. For example, if you place the code in an app's function you can simply call to that function. If you place the code ni an external Javascript file, you must use a bit of Javascript to call it. Take a look at the "External" app sample and also at the "External Javascript" tutorial in the App Builder's help file.

P.S. The CSS code probably can work... but is a good idea to separate it into the app's Inline CSS option or in an external CSS file.


Board footer

Powered by FluxBB