WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Show and Hide Tables, Table Rows, Form Elements Etc.
Categories : Java Script, Beginner Guides Click here to Update Your Picture
Brian Greenwood
Date : Aug 22nd 2006
Grade : 3 of 5 (graded 20 times)
Viewed : 104563
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Brian Greenwood
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

This is an example of how you can dynamically show and hide portions of a form or document by using an actuator like "onChange" or "onClick".

This is useful for forms, or a document were you might want to expand information if a person clicks the "more" link.

The example below uses a form toggle,

Be sure that when you call the function that you enclose the ID of the item in single quotes ''.

I will be posting examples of other practical uses later.

<html>
<head>
<title>toggle_it() Demo</title>
<script language="javascript">
  function toggle_it(itemID){
      // Toggle visibility between none and inline
      if ((document.getElementById(itemID).style.display == 'none'))
      {
        document.getElementById(itemID).style.display = 'inline';
      } else {
        document.getElementById(itemID).style.display = 'none';
      }
  }
</script>
<style type="text/css">
<!--
.style5 {font-family: Arial, Helvetica, sans-serif; font-size: 10; }
.style7 {font-family: Arial, Helvetica, sans-serif; font-size: 10px; }
-->
</style>
<body>
<form name="test" action="" method="post">
<table width="199">
<tr class="style7">
  <td width="50%" align="right" height="23" valign="middle"><a href="#" onClick="toggle_it('pr1')">Toggle Form?</a> :</td>
  <td height="23" valign="middle" > 
    </td>
</tr>
<tr >
  <td colspan="2">
        <!--
            This is the table we will be showing, or hiding. Note it's id.
            If you are producing a series of table rows from a database,
            you can give each row a dynamic id, perhaps the key for the row from the database,
            and use the show hide property for extended information, streamlining your page's presentation,
            but still giving the availability of all the information without additional page loads.
        -->
        <table width="100%" id="pr1" name="police_response1" style="display:none;">
          <tr>
            <td align="right"><span class="style7">Drop Box 1:</span></td>
              <td><span class="style5">
                <SELECT NAME='Numbers' class="style7" ID='Numbers'>
                <option value='00'>00</option>
                <option value='01'>01</option>
                <option value='01'>01</option>
                <option value='01'>01</option>
              </SELECT>
              </span> </td>
              </tr>
            <tr>
                  <td align="right"><span class="style7">Report Number:</span></td>
                  <td><INPUT NAME='Text' TYPE='textbox' class="style7" VALUE='' SIZE='12'></td>
            </tr>
        </table>
        </td>
    </tr>
</table>
</form>
</body>
</html>



Show or Hide your Content using Javascript
Categories : Java Script, HTML, CSS, Beginner Guides
Fancy Quick Access Navigation Link
Categories : Java Script, Navigation, User Interface, DHTML, Beginner Guides
Ajax - Perform a simple server side request and update the current HTML page.
Categories : AJAX, Java Script, Beginner Guides
PHP and javascript mouseover, mouseout, and mousedown events
Categories : PHP, Java Script, Form Processing, Beginner Guides
javascript cookie settings
Categories : Java Script, Beginner Guides
Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
Changing the Style of form objects using the JavaScript OnClick method.
Categories : Java Script, Form Processing, Beginner Guides, CSS
Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
JavaScript dropdown list menu to switch any page.
Categories : Java Script, Beginner Guides, Form Processing
Local Time clock and Server time usign PHP and JavaScript
Categories : PHP, Java Script, Date Time, Beginner Guides
Get your browser details using javascript
Categories : Java Script, Beginner Guides, Browsers
Validating a URL with JavaScript RegExp
Categories : Java Script, Data Validation, Beginner Guides
Store, retrieve and delete cookies using JavaScript.
Categories : Java Script, Cookies, Beginner Guides, Cookies
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
 Brian Greenwood wrote :1656
Please note, I did not test this in IE - it acts very weird in there... I will post a follow up fix. Works great in FireFox on the Mac though :)

My fault for posting prior to testing.