Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6101955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:33:32+00:00 2026-05-23T13:33:32+00:00

I have 3 functions (they are minimalized so they might be difficult to read)

  • 0

I have 3 functions (they are minimalized so they might be difficult to read) listed below – i0, t0, and is.

is() and t0() both pull data from the DOM with this line

  var c=document.forms[a].elements;

would it be better to pull the data from the DOM in i0(), and then pass it to is() and t0()?

That way I would only pull data from the DOM once, but then I would need an extra variable to store it in an pass it to the two functions.

i0():

function i0()
  {
  if(t0())
    {
    var a=is('f0');
    s0('bi0.php',a,s2);
    }
  }

t0:

function t0()
  {
  var a=document.forms['f0'].elements;
  a1="Please enter your credentials";
  a2="That email is not registered";
  a3="Incorrect credentials - Reset your password?";
  if(c0(a,a1,'fb1')&&c2(a[1],a2,'fb1')&&c3(a[2],a3,'fb1'))
    {
    return 1;
    }
  else
    {
    return 0;
    }
  }

is():

function is(a)
  {
  var b='';
  var c=document.forms[a].elements;
  for(i=0;i<c.length;i++)
    {
    if(c[i].name)
      {
      if(c[i].type=='checkbox'&&c[i].checked==false)
        {
        b+=c[i].name+"=NULL&";
        }
      else
        {
        b+=c[i].name+"="+c[i].value+"&";
        }
      }
    }
    b=b.slice(0,-1);
  return b;
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:33:32+00:00Added an answer on May 23, 2026 at 1:33 pm
    function i0(a){
        t0() && (a=is('f0'), s0('bi0.php', a, s2)); // just so I can use the comma like this
    }
    
    // or
    
    function i0(){
        t0() && s0('bio.php', is('f0'), s2);
    }
    
    function t0(){
        var a = document.forms['f0'].elements,
           a1 = "Please enter your credentials",
           a2 = "That email is not registered",
           a3 = "Incorrect credentials - Reset your password?";
    
        return +( c0(a,a1,'fb1') && c2(a[1],a2,'fb1') && c3(a[2],a3,'fb1') );
    }
    
    function is(a){
        var b = '',
            c = document.forms[a].elements;
    
        for( var i=0, l=c.length; i<l; i++ ){
            c[i].name
                ? c[i].type == 'checkbox' && !c[i].checked && b += c[i].name + '=NULL&'
                : b += c[i].name + '=' + c[i].value + '&';
        }
        return ( b = b.slice(0, -1) );
    }
    

    to answer your actual question, yes doing a single select on document.forms['f0'].elements will make things slightly faster in some browsers, but it’s a micro-optimization that I suspect will only be faster in old browsers (IE6) due to the hash-lookup.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen member functions programed both inside of the class they belong to
I have a windows application running at the backend. I have functions in this
Of course most languages have library functions for this, but suppose I want to
I have multiple setTimeout functions like this: function bigtomedium(visiblespan) { visiblespan.removeClass('big').addClass('medium'); setTimeout(function(){ mediumtosmall(visiblespan);},150); };
We have scalar functions in our database for returning things like number of tasks
I have several functions that I wrote and I use regularly on my servers,
I have two functions to add and remove table rows that contain a form
I want to make sure that a set of functions have the same signature
Many of the standard c library (fwrite, memset, malloc) functions have direct equivalents in
So let's say I have two different functions. One is a part of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.