473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Google Gadget

Expand|Select|Wrap|Line Numbers
  1. function checkWin()
  2. var val0;
  3.  var val1;
  4.  var val2;
  5. var status = _gel(status);                 //prob here
  6.  
  7.  // check columns
  8.  for(var y = 0; y < 3; y++)
  9.  {
  10.    val0 = _gel('b0_'+y +".value");               //prob here
  11.         val1 = _gel('b1_'+y +".value");
  12.         val2 = _gel('b2_'+y +".value");
  13.  
  14. if(val0 == 'X' && val1 == 'X' && val2 == 'X')
  15.    {
  16.       status.innerText = "X WINS!";
  17.       return true;
  18.    }
  19.    else if(val0 == 'O' && val1 == 'O' && val2 == 'O')
  20.    {
  21.       status.innerText = "O WINS!";
  22.       return true;
  23.    }
  24.  }
  25.  
  26.  // check rows
  27.  for(var x = 0; x < 3; x++)
  28.  {
  29.    val0 = _gel('b'+ x + '_0').value;
  30.    val1 = _gel('b'+ x + '_1').value;
  31.    val2 = _gel('b'+ x + '_2').value;
  32.    if(val0 == 'X' && val1 == 'X' && val2 == 'X')
  33.    {
  34.       status.innerText = "X WINS!";
  35.       return true;
  36.    }
  37.    else if(val0 == 'O' && val1 == 'O' && val2 == 'O')
  38.    {
  39.       status.innerText = "O WINS!";
  40.       return true;
  41.    }
  42.  }
  43.  
  44.  // check top left to lower right diagonal
  45.  val0 = _gel('b0_0').value;
  46.  val1 = _gel('b1_1').value;
  47.  val2 = _gel('b2_2').value;
  48.  if(val0 == 'X' && val1 == 'X' && val2 == 'X')
  49.  {
  50.    status.innerText = "X WINS!";
  51.    return true;
  52.  }
  53.  else if(val0 == 'O' && val1 == 'O' && val2 == 'O')
  54.  {
  55.    status.innerText = "O WINS!";
  56.    return true;
  57.  }
  58.  
  59.  // check lower left to top right diagonal
  60.  val0 = _gel('b2_0').value;
  61.  val1 = _gel('b1_1').value;
  62.  val2 = _gel('b0_2').value;
  63.  if(val0 == 'X' && val1 == 'X' && val2 == 'X')
  64.  {
  65.    status.innerText = "X WINS!";
  66.  return true;
  67.  }
  68.  else if(val0 == 'O' && val1 == 'O' && val2 == 'O')
  69.  {
  70.    status.innerText = "O WINS!";
  71.    return true;
  72.  }
  73.  
  74.  // no winner yet  return false;
  75. }
Im doin a google gadget and having prob with my _gel
this is a tic toe game
firstly (i put in comment) is that i cant get the status
second is i want to get the y value of my label name( my labels for playin are labeled as b0_0 b0_1 as so forth)
the sdk says object expected
Jan 24 '09 #1
9 3040
acoder
16,027 Expert Mod 8TB
How is the _gel function defined?
Jan 26 '09 #2
i var val0 earlier then val0=_gel.........
Feb 7 '09 #3
acoder
16,027 Expert Mod 8TB
I can see that, but can you post the code for it.
Feb 7 '09 #4
huh sorry i dont quite understn
Feb 8 '09 #5
acoder
16,027 Expert Mod 8TB
You've posted the code for the checkWin function, but some of the statements use a _gel function. Can you post the code for that too?
Feb 9 '09 #6
Oh sorry I found out my prob. The method document.getElementsById() is specific to DOM interaction in the browser. Google Desktop does not support these DOM calls.
Thank you for your concern in lookin into this though!
cheers!
Feb 10 '09 #7
acoder
16,027 Expert Mod 8TB
Thanks for that information. I would assume that was in the _gel() function. Just to point out that it's document.getElementById() (with no "s").

Finally, as a matter of interest, what's the alternative for Google Desktop?
Feb 10 '09 #8
Hahah i did it the very simple way ....novice way by calling the elements one by one... not actually overcomin the document/_gel way but i got my work done
Feb 11 '09 #9
acoder
16,027 Expert Mod 8TB
Thanks. You never know who and how many it may help.
Feb 12 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: daivdh | last post by:
I recently tried to download and install a Gadget called "Piano" which would put a piano keyboard on the screen. It downloaded and installed okay. When I dragged the keyboard from the sidebar onto...
2
by: NickP | last post by:
Hi there, I'm not sure if there is a newsgroup dedicated to Vista Sidebar development, but unfortunately I couldn't find one and as my code is VB.NET, I thought I best start here. I'm using...
4
by: Penn | last post by:
On my mac, I am running Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.7) Gecko/ 20070914 Firefox/2.0.0.7 and Safari Version 3.0.3 (522.12.1) My gadget:
7
by: alan75 | last post by:
1) is System.Gadget.Settings.write secure? would it be save to store login password? 2) this is the code i wrote to store the settings, but the value fail to save. did i do something wrong or...
2
by: Steven Tang | last post by:
It seems that we can only embed XBAP Iframe to create a WPF gadget, the WPF application will not work at this time (I tried Stanimir's demo, it is not different to a standalone WPF application, it...
0
by: | last post by:
It seems that we can only create a WPF gadget by embed XBAP Iframe, the WPF application will not work at this time (I tried Stanimir's demo, it is not different to a standalone WPF application, it...
4
by: =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post by:
I'm creating WPF gadget by embed XBAP Iframe: 1. Is it possible that create Pure WPF (non-XBAP) which could auto dock into the Vista sidebar when dragging the WPF application near Sidebar? 2. My...
7
by: Dominik | last post by:
Hi there, I am investigating a browser compatibility issue with Google' mobile talk gadget (http://talkgadget.google.com/talkgadget/m). Please compare my posting on:...
0
by: Jeff | last post by:
Hi I'm following this tutorial: http://dev.live.com/gadgets/sdk/docs/default.htm And downloaded that sample file. Now I've created a simple web gadget project on my own:. I just made a copy...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.