Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Aug 2011
    Posts
    228
    Member #
    29153
    Liked
    4 times
    I've created this but it has more options so I narrowed it down for an example. My problem is, I need to cut down the space created by all of the hidden form inputs. How can I do this? If I have 10 options, there is a bunch of blank space there before the next input. Not to mention, if they choose the 10th choice, they may not even see that anything has popped up. Is there a way to change all of that?

    Here's what I have....



    <script type="text/javascript">
    function selectevent(){

    if(this.value == "choice1")
    document.getElementById( "dv3").style.visibility = "hidden";
    if(this.value == "choice1")
    document.getElementById( "dv2").style.visibility = "hidden";
    if(this.value == "choice1")
    document.getElementById( "dv1").style.visibility = "visible";

    if(this.value == "choice2")
    document.getElementById( "dv2").style.visibility = "visible";
    if(this.value == "choice2")
    document.getElementById( "dv1").style.visibility = "hidden";
    if(this.value == "choice2")
    document.getElementById( "dv3").style.visibility = "hidden";

    if(this.value == "choice2")
    document.getElementById( "dv3").style.visibility = "visible";
    if(this.value == "choice2")
    document.getElementById( "dv2").style.visibility = "hidden";
    if(this.value == "choice2")
    document.getElementById( "dv1").style.visibility = "hidden";

    }
    </script>


    Event:

    <select name="event" id="sel1">
    <option value="">Select...</option>
    <option value="choice1">choice1</option>
    <option value="choice2">choice2</option>
    <option value="choice3">choice3</option>
    </select>

    <div id="dv1" style="visibility: hidden">
    1:
    <input type="varchar" id="txt1" name="choice1">
    </div>

    <div id="dv2" style="visibility: hidden">
    2:
    <input type="varchar" id="txt2" name="choice2">
    </div>

    <div id="dv3" style="visibility: hidden">
    3:
    <input type="varchar" id="txt3" name="choice3">
    </div>


    <script type="text/javascript">
    document.getElementById( "sel1").onchange = selectevent;

    </script>

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    You want display: none instead of visibility: hidden.

    The difference between the two is that visibility: hidden just hides the element, whereas display: none takes it out of the flow of the document completely (much as if you set width and height to 0 for that element).
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:43 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com