SHARE
TWEET

Untitled

a guest Feb 21st, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var favorite = ["swim","hamburgers","dogs"];
  2. var itemIndex = 0;
  3. fixScreen();
  4. onEvent("next", "click", function( ) {
  5.     itemIndex++;
  6.     if (itemIndex > (favorite.length - 1)) {
  7.       itemIndex = 0;
  8.     }
  9.     fixScreen();
  10.    
  11. });
  12. onEvent("last", "click", function( ) {
  13.     itemIndex--;
  14.     if (itemIndex < 0) {
  15.       itemIndex = favorite.length -1 ;
  16.     }
  17.     fixScreen();
  18.    
  19. });
  20. onEvent("add", "click", function( ) {
  21.   var idkw = getText("text_input1");
  22.   insertItem(favorite, itemIndex, idkw);
  23.   fixScreen();
  24. });
  25.  
  26.  
  27. function fixScreen() {
  28.   setText("text_area1", favorite[itemIndex]);
  29.   setText("page", (itemIndex + 1)+ " of " + favorite.length);
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top