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

  • SEARCH
  • Home
  • 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 7420351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:13:23+00:00 2026-05-29T08:13:23+00:00

I have some JavaScript that creates a row in a table and adds cells

  • 0

I have some JavaScript that creates a row in a table and adds cells to it. I need to put an colspan=2 on the second cell added (A.K.A the select cell), but I can’t figure out the best way to do this with the least change in the code because this affects a entire page of more code. Suggestions? (table id=table5 class=mytable)

    if(fltgrid)
{
    var fltrow = t.insertRow(0); //adds filter row
    fltrow.className = "fltrow";
    for(var i=0; i<n; i++)// this loop adds filters
    {
        var fltcell = fltrow.insertCell(i);
        //fltcell.noWrap = true;
        i==n-1 && displayBtn==true ? inpclass = "flt_s" : inpclass = "flt";

        if(f==undefined || f["col_"+i]==undefined || f["col_"+i]=="none") 
        {
            var inptype;
            (f==undefined || f["col_"+i]==undefined) ? inptype="text" : inptype="hidden";//show/hide input  
            var inp = createElm( "input",["id","flt"+i+"_"+id],["type",inptype],["class",inpclass] );                   
            inp.className = inpclass;// for ie<=6
            fltcell.appendChild(inp);
            if(enterkey) inp.onkeypress = DetectKey;
        }
        else if(f["col_"+i]=="select")
        {
            var slc = createElm( "select",["id","flt"+i+"_"+id],["class",inpclass] );
            slc.className = inpclass;// for ie<=6
            fltcell.appendChild(slc);
            PopulateOptions(id,i);
            if(displayPaging)//stores arguments for GroupByPage() fn
            {
                var args = new Array();
                args.push(id); args.push(i); args.push(n);
                args.push(display_allText); args.push(sort_slc); args.push(displayPaging);
                SlcArgs.push(args);
            }
            if(enterkey) slc.onkeypress = DetectKey;
            if(on_slcChange) 
            {
                (!modfilter_fn) ? slc.onchange = function(){ Filter(id); } : slc.onchange = f["mod_filter_fn"];
            } 
        }

        if(i==n-1 && displayBtn==true)// this adds button
        {
            var btn = createElm(
                                    "input",
                                    ["id","btn"+i+"_"+id],["type","button"],
                                    ["value",btntext],["class","btnflt"] 
                                );
            btn.className = "btnflt";

            fltcell.appendChild(btn);
            (!modfilter_fn) ? btn.onclick = function(){ Filter(id); } : btn.onclick = f["mod_filter_fn"];                   
        }//if       

    }// for i       
}//if fltgrid
  • 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-29T08:13:23+00:00Added an answer on May 29, 2026 at 8:13 am

    If I understand you correctly, you can change the code block in the else if to the following:

    var slc = createElm( "select",["id","flt"+i+"_"+id],["class",inpclass] );
    slc.className = inpclass;// for ie<=6
    fltcell.appendChild(slc);
    fltcell.setAttribute("colspan",2);
    PopulateOptions(id,i);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some JavaScript that creates Forward and Back buttons. However, I need to
I have some javascript code that creates an img tag with a mouseover callback,
I have some Javascript code that creates 2 arrays: One for Product Category and
I have some code that dynamically creates a new button through JavaScript that when
I have some code in umbraco that is run and creates a javascript file
I have some javascript that I'm trying to retool using jQuery to learn the
I have some javascript that goes out and fetches a javascript class on another
Here is the situation. I have some javascript that looks like this: function onSubmit()
I have some Javascript code that will programmatically register an COM interop assembly by
I have some JavaScript code that works in IE containing the following: myElement.innerText =

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.