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
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
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 : Balance values between two list boxes. Change the value of list box A acording to the value in list box B and vice versa using Javasvript.
Categories : Java Script, Form Processing
Chetankumar Akarte
Date : Dec 08th 2006
Grade : 1 of 5 (graded 1 times)
Viewed : 7711
File : 4548.zip
Images : Image 1
Search : More code by Chetankumar Akarte
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.
 

Auto balancer

In this example we see an example of how to auto balance two list boxs...
Whenever one of the two is selected another is automatically changed.

Example –         When you select 40% in one box, the other box is set to 60% and vice versa.

We do this using function balance(id) and calling it when we make a change on the combo box value. And subtract the value from 100 & set another combo according to that.

<html><head>

<SCRIPT LANGUAGE="JavaScript">
<!--
function balance(id){
  if(id == "Sel1"){
    ValueSet = document.getElementById("Sel1").value;
    if(ValueSet == " " && ValueSet != ""){
      document.getElementById("Sel2").value = " ";
    } else {
      document.getElementById("Sel2").value = 100 - ValueSet;
    }
  } else {
    ValueSet = document.getElementById("Sel2").value;
    if(ValueSet == " " && ValueSet != ""){
      document.getElementById("Sel1").value = " ";
    } else {
      document.getElementById("Sel1").value = 100 - ValueSet;
    }
  }
}
// End hiding -->
</SCRIPT>

</head><body>

<table>
  <tr>
    <td><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Select1</font></strong></td>
    <td><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">   </font></strong></td>
    <td><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Select2</font></strong></td>
  </tr>
  <tr>
    <td align="Center"><SELECT NAME="Sel1" id="Sel1" onChange="balance('Sel1');">
        <OPTION VALUE=" "> </option>
        <OPTION VALUE="0" >0</option>
        <OPTION VALUE="10" >10</option>
        <OPTION VALUE="20" >20</option>
        <OPTION VALUE="30" >30</option>
        <OPTION VALUE="40" >40</option>
        <OPTION VALUE="50" >50</option>
        <OPTION VALUE="60" >60</option>
        <OPTION VALUE="70" >70</option>
        <OPTION VALUE="80" >80</option>
        <OPTION VALUE="90" >90</option>
        <OPTION VALUE="100" >100</option>
      </select></td>
    <td>   </td>
    <td align="Center"><SELECT NAME="Sel2" id="Sel2" onChange="balance('Sel2');">
        <OPTION VALUE=" "> </option>
        <OPTION VALUE="0" >0</option>
        <OPTION VALUE="10" >10</option>
        <OPTION VALUE="20" >20</option>
        <OPTION VALUE="30" >30</option>
        <OPTION VALUE="40" >40</option>
        <OPTION VALUE="50" >50</option>
        <OPTION VALUE="60" >60</option>
        <OPTION VALUE="70" >70</option>
        <OPTION VALUE="80" >80</option>
        <OPTION VALUE="90" >90</option>
        <OPTION VALUE="100" >100</option>
      </select></td>
  </tr>
</table>



Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
Javascript URL and Email Validation
Categories : Java Script, Data Validation, Form Processing, Email, URLs
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
Building a Dynamic Form using Javascript and innerHTML. Add form elements in realtime without refreshing the page.
Categories : Java Script, Form Processing
Form validations using javascript and including all validations in one message
Categories : HTML and PHP, Java Script, Form Processing
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
Hilight Form Element onFocus
Categories : Java Script, Form Processing, CSS
Upload any fixed type of files, control file type through javascript and encrypt filename using php so file not get overwrite
Categories : PHP, Java Script, Functions, PHP References, Form Processing
showing Help (assistance) to the user while filling html forms.
Categories : HTML, Java Script, Form Processing
Adding a Filter to a Text Element
Categories : Java Script, Data Validation, Form Processing
PHP and javascript mouseover, mouseout, and mousedown events
Categories : PHP, 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
JavaScript dropdown list menu to switch any page.
Categories : Java Script, Beginner Guides, Form Processing
Check if Javascript is Enabled or Disabled - Works in all Browsers
Categories : Java Script, HTML, Web Browsers
Page Loading Message shown during the time your site's page is being loaded.
Categories : HTML, CSS, Java Script