I'm currently working on creating a "Pad," but I am struggling to figure out how to do it.
If you take a look at the Fiddle, you'll notice that the "Content" is padded intentionally. I know how to achieve this using a table.
However, when including Javascript, I discovered that if I use a table, everything appears regardless of the script and div tags, which is not what I want.
What I'm looking for is a way to add padding to the section after "Content" so that it aligns properly. Perhaps I'm building the table incorrectly; at this point, I am more interested in learning how to accomplish this without tables in HTML.
Any assistance or guidance would be highly appreciated.
Javascript:
function selection(){
var myEvaluator = addendaList.options[addendaList.selectedIndex].value;
var referenceNumberId = document.getElementById("referenceNumberBlock");
var deliveryIdentificationId = document.getElementById("deliveryIdentificationBlock");
var currencyISOCodeId = document.getElementById("currencyISOCodeBlock");
var referenceTrafficId = document.getElementById("referenceTrafficBlock");
if( myEvaluator == "IMP" ) {
referenceNumberId.style.display = "block";
deliveryIdentificationId.style.display = "block";
currencyISOCodeId.style.display = "none";
referenceTrafficId.style.display = "none";
} else if ( myEvaluator == "EXP" ) {
referenceNumberId.style.display = "none";
deliveryIdentificationId.style.display = "none";
currencyISOCodeId.style.display = "block";
referenceTrafficId.style.display = "block";
}
}
HTML
<body>
<table width="620" align="center" cellpadding="0" cellspacing="0">
<td width="160" valign="top">
<b>Content</b>
</td>
</table>
<b>Select an option: </b>
<select name = "code" id = "addendaList" onChange = "select()">
<option value = "IMP">Import</option>
<option value = "EXP">Export</option>
</select>
<div ID = "referenceNumberBlock" style = "display:block;">
<b>Reference Number: </b>
<input name = "referenceNumber" id = "referenceNumber" type = "text" size = "16" maxlength="15" value = "">
</div>
<div ID = "deliveryIdentificationBlock" style = "display:block;">
<b>Delivery Identification: </b>
<input id = "deliveryIdentification" name = "deliveryIDentification" type = "text" size = "16" maxlength = "30" value = "">
</div>
<div ID = "currencyISOCodeBlock" style = "display:none;">
<b>Currency ISO Code: </b>
<select id = "ISOCodes" name = "currencyISOCode">
<option value = "MXN">MXN</option>
<option value = "USD">USD</option>
</select>
</div>
<div ID = "referenceTrafficBlock" style ="display:none;">
<b>Traffic Number: </b>
<input name = "referenceTraffic" type = "text" size = "16" maxlength = "20" value = "">
<div>
</body>
Fiddle: http://jsfiddle.net/tL98L/4/
Updated Fiddle with solution: http://jsfiddle.net/tL98L/18/