Deprecated: Function set_magic_quotes_runtime() is deprecated in /home4/mfoster/public_html/cb/forums/include/common.php on line 62

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 31

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 34
Cross-Browser.com / Two functions in X almost the same

Cross-Browser.com

X Library Forums

You are not logged in.

Announcement

New user registration is currently disabled.

#1 December 17, 2009 11:08:03 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Two functions in X almost the same

Ack, I added a function when there was already one like it. I added xGetElementsByIdN but xEachNum was already in X and does about the same thing.

Hmmm...

Offline

 

#2 December 18, 2009 9:20:01 am

DaveMorton
Member
From: Carson City, NV
Registered: November 27, 2009
Posts: 49
Website

Re: Two functions in X almost the same

Did you forget to read the manifest before writing that function, Mike? big_smile


Safe, Reliable Insanity, since 1961!
http://www.geekcavecreations.com

Offline

 

#3 December 18, 2009 9:55:07 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: Two functions in X almost the same

Yep smile, don't know what I was thinking

Offline

 

#4 December 18, 2009 10:25:55 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: Two functions in X almost the same

Here's the two functions in question...

xGetElementsByIdN


function xGetElementsByIdN(p,i,f,d)
{
  var e, r = [];
  i = i || 0;
  e = xGetElementById(p + i);
  while (e) {
    if (f) {
      f(e, i, d);
    }
    r[r.length] = e;
    e = xGetElementById(p + (++i));
  }
  return r;
}



xEachNum


I think I like this one better.

function xEachNum(p,i,d,f)
{
  var e = xGetElementById(p + i);
  while (e) {
    f(e, i, d);
    e = xGetElementById(p + (++i));
  }
}

Offline

 

#5 December 20, 2009 3:01:48 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: Two functions in X almost the same

I dropped xGetElementsByIdN and added xEachId smile

Offline

 

Board footer

Powered by PunBB 1.2.15
Copyright © 2002–2005 Rickard Andersson

Expand Restore Select Format Eval Load