Two boxes, two max values - but not set which value belongs to which box
<p>Hopefully I can explain what I'm looking for...</p>

<p>I've got two text boxes: Length and Width</p>

<p>In one box the max value is 200 while in the other it's 100. At the moment I'm using this code:</p>

<pre><code>document.getElementById('Length').onchange = function(){
      if(this.value &gt; 200){
           this.value = 200;
      }
      if(this.value &lt; 10){
           this.value = 10;
      }
}


    document.getElementById('Width').onchange = function(){
      if(this.value &gt; 100){
           this.value = 100;
      }
      if(this.value &lt; 20){
           this.value = 20;
      }
}
</code></pre>

<p><strong>Here's the tricky part:</strong> I would like it to not be set which box has which max value. That should depend on what the customer types. 
If someone types a value of under 100 in Length, then Width's max is the 200. But if someone types "158" in Length then Width's max should be the 100 and Length's max is the 200. And Vice versa. </p>

<p>Also, if someone first types 150 in Length and then types 160 in Width, then the 250 in Length should be changed to 100 - so the 200 max value should belong to the box that's most recently has a value higher than the 100 max.</p>

<p><strong>Edit:</strong> Also, would it be possible to have the max values to be connected with a minimum value? So the box that gets the 200 max also has a 10 minimum and then the other box has the 100 max and the 20 minimum.
Hope that's understandable.</p>
