Form Component – Same Widths

[Total: 0    Average: 0/5]

This shows how to have form components have the same width sizes.

Body Code:

<script>
var PAD_SIZE=25;
var CHAR_WIDTH=7; // ?? no idea what number to use...(depends on font)
var isIE=document.all?true:false;
var isNS=document.layers?true:false;
var WID=isIE?'style="width:'+(PAD_SIZE*CHAR_WIDTH)+'"':'';
var PAD=isNS?'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;':'';
</script>
<form name=exf1>
  <table border=1>
  <tr><td align=center>Text Input</td><td align=center>Select List 1</td><td align=center>Select List 2</td></tr>
  <tr><td align=center>
  <script>
  document.write('<input type=text name="text1" size="'+PAD_SIZE+'">');
  </script>
  </td>
  <td align=center>
  <script>
  var _o  = '<select '+WID+' name="text2" size=1>';
      _o += '<option value="0">Select what you want'+PAD+'</option>';
      _o += '<option value="1">testA</option>';
	  _o += '</select>';
  document.write(_o);
  </script>
  </td>
  <td align=center>
  <script>
  var _o  = '<select '+WID+' name="text3" size=1>';
      _o += '<option value="0">Select test'+PAD+'</option>';
      _o += '<option value="1">testB</option>';
	  _o += '</select>';
  document.write(_o);
  </script>
  </td>
  </tr>
  </table> 
  </form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *