Page 1 of 1

Basic javascript

Posted: Thu Feb 16, 2012 5:15 pm
by richsaw

Enjoying getting to grips with tiggzi but my javascript knowledge leaves a little to be desired. I'm initially trying to do something relatively basic:

On a screen i have a blank grid with 7 rows and 10 columns. When a user clicks on a grid cell i'd like an image to appear in that cell. If they press again then it would disappear.

I'm also trying to get to grips with how to output data to specific cells or labels in Tiggzi elements. ie document.write fills a blank page, how do I output custom javascript to a named label or text area?


Basic javascript

Posted: Thu Feb 16, 2012 5:34 pm
by maxkatz

Are you working with Mobile App Builder or Prototype Builder?


Basic javascript

Posted: Thu Feb 16, 2012 5:48 pm
by richsaw

Mobile app builder


Basic javascript

Posted: Thu Feb 16, 2012 8:48 pm
by maxkatz

I'd just start with a single image on a screen. With a single image, use click event and then hide the image. You can do it via Set Property action (but also possible directly via JavaScript). Then, you need to click in the same area again, maybe a button to show the image. Hope this helps...


Basic javascript

Posted: Thu Feb 16, 2012 9:46 pm
by richsaw

Genius! Simple always best. Thanks :)

The other question is lets say I have a JS code that outputs the day of the week. 'Monday'. How do I enable that variable to be output in a specifc label or grid on Load?

Instead of an Alert as in the js api here: http://help.gotiggr.com/documentation... and where document.write clears the screen.


Basic javascript

Posted: Thu Feb 16, 2012 9:53 pm
by maxkatz

code
Tiggr('mobilelabel1').text('Monday');
/code


Basic javascript

Posted: Thu Feb 16, 2012 10:50 pm
by richsaw

Thanks. Just what I needed, I understand it now.

I was calling a variable for todays date and it works calling the today variable :)

precode
var now = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
today = days[now.getDay()]
Tiggr('mobilelabel1').text(today);
/code/pre