SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I make conditional forms using javascript?

    I want to be able to make a form that will hide or unhide elements when an option is selected. how do i do this?

  2. #2
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no one has a clue, ehh?

  3. #3
    SitePoint Member
    Join Date
    Jul 2001
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What type of element are you trying to hide?

  4. #4
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've seen this before with DHTML.

    Code:
    <html>
    <head>
    <!--
    This file retrieved from the JS-Examples archives
    http://www.js-examples.com
    100s of free ready to use scripts, tutorials, forums.
    Author: JS-Examples - http://www.js-examples.com/ 
    -->
    
    <script type=text/javascript>
    var isNS = navigator.appName.indexOf("Netscape")  != -1
    var isIE = navigator.appName.indexOf("Microsoft") != -1
    function show() {
      if (isNS) document.layers["d1"].visibility = "show";
      if (isIE) document.all.d1.style.visibility = "visible";
    }
    function hide() {
      if (isNS) document.layers["d1"].visibility = "hide";
      if (isIE) document.all.d1.style.visibility = "hidden";
    }
    </script>
    
    
    </head>
    <body>
    
    <a href="javascript:show()">CLICK ME TO SHOW MESSAGE</a>
    <BR><BR>
    <a href="javascript:hide()">CLICK ME TO HIDE MESSAGE</a>
    <div id="d1" style="visibility:hidden;position:relative;top:10;left:10">
    <B>Hidden Message</b>
    </div>
    
    
    </body>
    </html>
    This may not be exactly what you are lokoing for, but it should help!

  5. #5
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by muleteam
    What type of element are you trying to hide?
    just form elements, like text boxes, radio buttons, etc.

  6. #6
    SitePoint Member
    Join Date
    Jul 2001
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think moospot is right. . . .DHTML layers are only option I can think of. Otherwise you would probably have to reload the page.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •