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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:28:33+00:00 2026-05-17T16:28:33+00:00

I have a table: <table> <tr> <td colspan=2><h2>Order Awards here:</h2></td> </tr> <tr> <td class=aocBlack>Delivery:</td>

  • 0

I have a table:

<table>
<tr>
  <td colspan="2"><h2>Order Awards here:</h2></td>
</tr>

<tr>
  <td class="aocBlack">Delivery:</td>
  <td>
    <select style="width: 200px;" id="deliveryMethod" name="deliveryMethod" size="1" onchange="showMailing()">
       <option value="print">I will print it myself.</option>
       <option value="mail">Please mail it to me.</option></select>
  </td>
</tr>

<tr id="messageText" style="">
  <td class="aocBlack" colspan="2">Message to appear on card:</td>
</tr>
<tr id="messageText2" style="">
  <td colspan="2"><textarea id="certMessage" name="certMessage" rows="5" cols="10" style="width: 284px;"></textarea></td>
</tr>
</table>

When the select box called deliveryMethod is set to “print”, the following two table rows (id messageText and messageText2) should be visible. When it’s set to “mail”, they should be hidden. I have some javascript that’s worked before with no problem, but the id’s I was targeting before were always divs. I don’t know if table rows behave differently, but I’m getting some strange results. Here’s the JS:

function showMailing(){
    e = document.getElementById("deliveryMethod");
    eVal = e.options[e.selectedIndex].value;

    if (eVal == "mail"){
        document.getElementById("messageText").style.display="none";
        document.getElementById("messageText2").style.display="none";
    }else{
        document.getElementById("messageText").style.display="inline";
        document.getElementById("messageText2").style.display="inline";
    }
}

The results are somewhat strange, to my (admittedly javascript/css-rusty) eyes. For example, when the page initially loads, everything displays as it’s supposed to: the dropdown’s default value is “print”, and so the two table rows in question display. When you change the dropdown to “mail”, they both disappear. But when you change it back, the fields are all pushed over out of where they’re supposed to be. These results are consistent across FF and Chrome (strangely it works correctly in IE) so I have to assume I’m doing something wrong, but I don’t know what.

Here are some screenshots (note there are a few fields displayed in the screenshot that I’ve stripped out of the code shown here just for clarity.) Can anyone help me out here?

On initial load:

alt text

After changing from print to mail:

alt text

After changing back from mail to print:

alt text

  • 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-17T16:28:34+00:00Added an answer on May 17, 2026 at 4:28 pm

    The default display value for a table row is table-row(*). If you set it to inline instead you’ll be asking the browser to draw table cells inside inline text instead of a row, which will confuse it and give unspecified results.

    (*: except on IE<8, which don’t support the table-related display values, instead setting them all to block and giving the elements themselves magic layout powers.)

    The better way do show/hide, where you don’t have to worry about what the default display value might be, is to define a class:

    .hidden { display: none; }
    

    and then toggle that class on and off the element.

    document.getElementById('deliveryMethod').onchange= function() {
        var cls= this.value==='mail'? 'hidden' : '';
        document.getElementById('messageText').className= cls;
        document.getElementById('messageText2').className= cls;
    };
    

    Assigning the handler from script allows you to drop the onchange inline attribute. You also don’t need size="1" (that goes without saying for a single-select), or the style="".

    The business with reading the select’s value using this.options[this.selectedIndex].value you probably don’t need any more, unless you’re dealing with ancient browsers.

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

Sidebar

Related Questions

I have table with 50 entries (users with such details like Name Surname Location
I have a table with a structure like the following: LocationID AccountNumber long-guid-here 12345
I have table inside a div tab. The table has 40 rows in it
I have table rows of data in html being filled from a CGI application.
Imagine I have table like this: id:Product:shop_id 1:Basketball:41 2:Football:41 3:Rocket:45 4:Car:86 5:Plane:86 Now, this
While trying to use LINQ to SQL I encountered several problems. I have table
I have a table with more than a millon rows. This table is used
I have a table in a SQL Server 2005 database with a trigger that
I have a table story_category in my database with corrupt entries. The next query
I have a table which is full of arbitrarily formatted phone numbers, like this

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.