Doh!

This is a discussion on "Doh!" within the JavaScript Forum section. This forum, and the thread "Doh! are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 23rd, 2006, 16:35
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,761
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Doh!

Ok so I got things a working, DB connectivity, generating the bingo cards by number of entries in the databse etc... One question.. How would one select the middle cell or in this case after generation 4th from top (Due to Bingo heading), 3rd from left and bottom after the table is drawn? I have been googling away for this and nothing so far. Everything is working perfectly as it should but I need to change the content of this middle cell to "Free + an employee ID" from the database which in itself is simple, its selecting the cell to do it. and then simply doing a foo.innerText = "blah"..
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote

  #2 (permalink)  
Old Aug 23rd, 2006, 20:28
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Doh!

If it's always going to be the same cell, why don't you just check where you are in the loop generation process and add the necessary.

In pseudo form:

if outer loop = 4 and inner loop = 3 add ID.
Reply With Quote
  #3 (permalink)  
Old Aug 23rd, 2006, 20:31
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,761
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Doh!

I thought about something like that but I wasn't quite sure of the best method or approach. That makes complete sense! I dislike using launguages I really don't know, but then again ya learn. Ok I am going to fiddle around and see if I can't get that working.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)

Last edited by moojoo; Aug 23rd, 2006 at 20:33.
Reply With Quote
  #4 (permalink)  
Old Aug 23rd, 2006, 21:07
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,761
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Doh!

So say I have:

Code: Select all
for (r = 0; r < NROWS; r++) {
        var tr = tbl.insertRow();
        for (c = 0; c < NROWS; c++) {
            var tc = tr.insertCell();
            tc.id = "Cell" + r + c;
            // The number of nodes left
            nNodes = root.childNodes.length;
I would need something like:

Code: Select all
// sets free box
            if (r = 4 and c = 3) {
            tc.id = "freebox";
            }
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #5 (permalink)  
Old Aug 23rd, 2006, 22:13
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Doh!

Looks good to me;-)
Reply With Quote
  #6 (permalink)  
Old Aug 24th, 2006, 15:16
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,761
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Doh!

Bleh, so this is whats happening heh:

Code: Select all
// sets free box
            if (r = 4 and c = 3) {
            tc.id = "freebox";
            tc.innerText = monthnumber + "/" + monthday + "/" + year;
            }
is generating an error on line 18

Code: Select all
var tr = tbl.insertRow();
saying it is expecting a ')' and when I run the script I get an object expected error on line 0.. When I remove the free box setting js it all works fine. So the question is, is it syntax error or placement?

Edit:

I did some searching and now I am just getting an Object Expected Error. Apparently this is some issue with IE's js handling.. I am mixing VB and JS but not together. Well except for JS outputting a vbscript db result.. Shoot.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)

Last edited by moojoo; Aug 24th, 2006 at 16:09.
Reply With Quote
  #7 (permalink)  
Old Aug 30th, 2006, 08:42
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Doh!

Been away so only just got back to looking at your post. You may have fixed it by now but...
Code: Select all
if (r = 4 and c = 3)
In this code, you want '==' to make a comparison. A sigle'=' is an assignment. Also you might want to put brackets around each of the comparisons to make sure the 'and' is not taking precedence.
Reply With Quote
  #8 (permalink)  
Old Aug 30th, 2006, 13:45
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,761
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Doh!

Got it.

Code: Select all
// Set the class of the free box to .freebox
            if (tc.className == "Cell22") {
            tc.className = "freebox";
            }
            
            // Set the properties for the middle/free cell
            if (tc.className == "freebox") {
            tc.innerText = "FREE " + month + "/" + day + "/" + year;
            }
Works fantastic. Thanks for your help.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)

Last edited by moojoo; Aug 30th, 2006 at 17:28.
Reply With Quote
Reply

Tags
doh

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:19.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43