richsaw
Posts: 0
Joined: Thu Feb 16, 2012 5:15 pm

Basic javascript

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Basic javascript

Are you working with Mobile App Builder or Prototype Builder?

richsaw
Posts: 0
Joined: Thu Feb 16, 2012 5:15 pm

Basic javascript

Mobile app builder

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Basic javascript

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...

richsaw
Posts: 0
Joined: Thu Feb 16, 2012 5:15 pm

Basic javascript

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.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Basic javascript

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

richsaw
Posts: 0
Joined: Thu Feb 16, 2012 5:15 pm

Basic javascript

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

Return to “Issues”