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 6475865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:22+00:00 2026-05-25T06:45:22+00:00

I’m having a little trouble attacking this problem and wondered if anyone could push

  • 0

I’m having a little trouble attacking this problem and wondered if anyone could push me in the right direction. What I would like to do is have a list that’s have two components, a label and value. So in essence I would like a list that looks like a table with the ability to scroll up and down (since my size is preset and I have to display all the values), I’m just not sure how to approach it.

My first approach was just to embed a table with all my values inside of a div with overflow:scroll. Which was great until I brought it into Mobile Opera, where overflow doesn’t work.

For a quick fix I threw my labels and values into separate select lists, which does work and look good. Except I don’t want to have to scroll them independently, i.e. the labels weren’t matching their values if I scrolled one and not the other.

A quick and dirty approach I have now is just combining them as strings into a single option, but it does not really look good and I would ideally like to text-align:left / text-align:right for better viewing.

What I have so far:

    var statusVarLabel = ["label 1","label 2","label 3","label 4","label 5","label 6","label 7","label 8","label 9","label 10","label 11","label 12","label 13","label 14","label 15","label 16","label 17","label 18","label 19","label 20"];
    var statusVarInfo = ["variable 1","variable 2","variable 3","variable 4","variable 5","variable 6","variable 7","variable 8","variable 9","variable 10","variable 11","variable 12","variable 13","variable 14","variable 15","variable 16","variable 17","variable 18","variable 19","variable 20"];
    function getStatus(){
        var varContainer = document.getElementById("varContainer");
        varContainer.size = statusVarLabel.length;
        tabSpacing = 0;
        for (var i=0; i < statusVarLabel.length; i++) {
            if (tabSpacing < statusVarInfo[i].length)
                tabSpacing = statusVarInfo[i].length;
        };
        for (var i=0; i < statusVarLabel.length; i++) {
            var check = 0;
            for (var j=0; j < varContainer.length; j++) {
                if ( statusVarLabel[i] == varContainer.options[j].text.slice(0,statusVarLabel[i].length)){
                    check = 1;
                    break;
                }
            };              
            var stringSpacing = "";
            for (var k=0; k < (tabSpacing-statusVarInfo[i].length)+5; k++) {
                stringSpacing = stringSpacing + " ";
            };
            if (check == 0)
                addOption(varContainer, statusVarLabel[i] + stringSpacing + statusVarInfo[i], i);
        };          
    }

Just wondering if anyone out there has run into the same problem. I’m still a bit new to the HTML game, is there a way to embed a table or div within a list?

  • 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-25T06:45:23+00:00Added an answer on May 25, 2026 at 6:45 am

    In select list elements, you can only have option and optgroup elements. Nothing else is supported.

    Ideally, you could use a table with a custom JavaScript scrollbar widget; this would allow you to work around Mobile Opera’s problems with overflow. But a fully functional scrollbar is quite complex and it takes time to implement. Of course you can search for a jQuery plugin or something similar, but you might have to resort to a partially functional scrollbar, for example one that does not handle dragging. Just keep in mind that when they see a scrollbar, certain users may expect that it will work exactly like a native scrollbar.

    Otherwise, if you want to keep it simple, it is possible to “couple” two or more select lists so that when you scroll one, the others scroll synchronously.

    For example, using the onscroll event and the scrollTop property:

    HTML

    <div id="varContainer">
        <select id="seVarLabels" style="text-align: left"></select>
        <select id="seVarInfos" style="text-align: right"></select>
    </div>
    

    JavaScript

    var varContainer = document.getElementById(“varContainer”);

    var seVarLabels = document.getElementById("seVarLabels");
    seVarLabels.size = statusVarLabel.length;
    
    var seVarInfos = document.getElementById("seVarInfos");
    seVarInfos.size = statusVarInfo.length;
    
    
    seVarLabels.onscroll =  function () {
        seVarInfos.scrollTop = this.scrollTop;
    };
    seVarLabels.onclick =  function () {
        seVarInfos.selectedIndex = this.selectedIndex;
    }
    seVarInfos.onscroll =  function () {
        seVarLabels.scrollTop = this.scrollTop;
    }
    seVarInfos.onclick = function () {
        seVarLabels.selectedIndex = this.selectedIndex;
    }
    
    for (var i=0; i < statusVarLabel.length; i++) {
        addOption(seVarLabels, statusVarLabel[i], i);
        addOption(seVarInfos, statusVarInfo[i], i);
    }
    

    It worked in Firefox, but I could not test it on Mobile Opera.

    An inconvenient of this approach is that you will have a vertical scrollbar between the two lists; however, using CSS it should be possible to position the second list so that it hides that scrollbar by overlapping the first list by the scrollbar’s width.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I've got a string that has curly quotes in it. I'd like to replace
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build

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.