このコードは、測定単位に基づいて計算することになっています。測定単位がユニット、ベッド、または部屋の場合、ユニット、ベッド、または部屋の量から空きユニット、ベッド、または部屋の量を引いたものに基づいて、占有されているユニットと空いているユニットの合計占有率テキスト ボックスにパーセンテージが表示されるはずです。部屋。計算が平方フィートに基づいている場合、正味平方フィートを占有スペースから空きスペースの量を引いたもので割ることになっています。
2 番目の計算は、4 つの異なるテキスト ボックスの単純な合計です。単純かもしれませんが、それでも機能しません....:(
どんな助けでも大歓迎です!
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Total Number of Units/Rooms/Beds</title>
</head>
<script language="javascript" type="text/javascript">
function calcPercentOccupied() {
var OccObj = document.getElementById("OccupiedSpaceText").innerHTML;
if (document.getElementsByName("MeasurementUnitType").value == 'Units' || document.getElementsByName("MeasurementUnitType").value == 'Rooms' || document.getElementsByName("MeasurementUnitType").value == 'Beds') {
if (document.getElementsByName("OccupiedSpaceValue").value == '' && document.getElementsByName("NumberOfUnitsRoomsBedsCount").value == '') {
alert('Please input "Total Number of ' + OccObj + ' and "Occupied ' + OccObj + '"');
} else {
with(document.forms[0]) {
NumberOfUnitsRoomsBeds = document.getElementsByName("NumberOfUnitsRoomsBedsCount").value;
OccupiedSpace = document.getElementsByName("OccupiedSpaceValue").value;
document.getElementsByName("NumberOfUnitsRoomsBedsCount").value = Math.round((OccupiedSpace / NumberOfUnitsRoomsBeds) * 10000) / 100 + "%";
}
}
} else if (document.getElementsByName("MeasurementUnitType").value == 'Sq. Feet') {
if (document.getElementsByName("NetRentableSquareFootage").value == '' && document.getElementsByName("OccupiedSpaceValue").value == '') {
alert('Please input "Total Sq. Feet (Net/Rentable)" and "Occupied ' + OccObj + '"');
} else {
with(document.forms[0]) {
NetSquareFootage = document.getElementsByName("NetRentableSquareFootage").value;
OccupiedSpace = document.getElementsByName("OccupiedSpaceValue").value;
document.getElementsByName("NumberOfUnitsRoomsBedsCount").value = Math.round((OccupiedSpace / NetSquareFootage) * 10000) / 100 + "%";
}
}
} else {
alert('Please select a "Unit of Measurement"');
}
}
function addOccupiedSpaceText() {
if (document.getElementsByName("MeasurementUnitType").value == '') {
document.getElementById("OccupiedSpaceText").innerHTML = "Space";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Units') {
document.getElementById("OccupiedSpaceText").innerHTML = "Units";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Rooms') {
document.getElementById("OccupiedSpaceText").innerHTML = "Rooms";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Beds') {
document.getElementById("OccupiedSpaceText").innerHTML = "Beds";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Sq. Feet') {
document.getElementById("OccupiedSpaceText").innerHTML = "Sq. Feet";
}
}
function addVacantSpaceText() {
if (document.getElementsByName("MeasurementUnitType").value == '') {
document.getElementById("VacantSpaceText").innerHTML = "Space";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Units') {
document.getElementById("VacantSpaceText").innerHTML = "Units";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Rooms') {
document.getElementById("VacantSpaceText").innerHTML = "Rooms";
}`
else if (document.getElementsByName("MeasurementUnitType").value == 'Beds') {
document.getElementById("VacantSpaceText").innerHTML = "Beds";
}`
else if (document.getElementsByName("MeasurementUnitType").value == 'Sq. Feet') {
document.getElementById("VacantSpaceText").innerHTML = "Sq. Feet";
}
}
function addTotalUnitsRoomsBedsText() {`
if (document.getElementsByName("MeasurementUnitType").value == '') {
document.getElementById("TotalUnitsRoomsBeds").innerHTML = "Units/Rooms/Beds";
}`
else if (document.getElementsByName("MeasurementUnitType").value == 'Units') {
document.getElementById("TotalUnitsRoomsBeds").innerHTML = "Units";
}`
else if (document.getElementsByName("MeasurementUnitType").value == 'Rooms') {
document.getElementById("TotalUnitsRoomsBeds").innerHTML = "Rooms";
}`
else if (document.getElementsByName("MeasurementUnitType").value == 'Beds') {
document.getElementById("TotalUnitsRoomsBeds").innerHTML = "Beds";
}`
else if (document.getElementsByName("MeasurementUnitType").value == 'Sq. Feet') {
document.getElementById("TotalUnitsRoomsBeds").innerHTML = "Units/Rooms/Beds";
}`
}
function addDownUnitsRoomsBedsText() {`
if (document.getElementsByName("MeasurementUnitType").value == '') {
document.getElementById("DownUnitsRoomsBeds").innerHTML = "Units/Rooms/Beds";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Units') {
document.getElementById("DownUnitsRoomsBeds").innerHTML = "Units";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Rooms') {
document.getElementById("DownUnitsRoomsBeds").innerHTML = "Rooms";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Beds') {
document.getElementById("DownUnitsRoomsBeds").innerHTML = "Beds";
} else if (document.getElementsByName("MeasurementUnitType").value == 'Sq. Feet') {
document.getElementById("DownUnitsRoomsBeds").innerHTML = "Units/Rooms/Beds";
}
}
</script>
<body>
<form method="post" action>
<table width="700">
<tr>
<td width="40%"></td>
<td width="11%"></td>
<td width="27%" colspan="2"></td>
<td width="22%"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td>Total Number of Units/Rooms/Beds:</td>
<td>
<input type="text" name="NumberOfUnitsRoomsBedsCount" id="TotalUnitsRoomsBeds" tabindex="41">
</td>
<td>Total Sq. Feet (Net/Rentable):</td>
<td>
<input type="text" name="NetRentableSquareFootage" tabindex="47">
</td>
</tr>
<tr>
<td>Total Number of Down Units/Rooms/Beds:</td>
<td>
<input type="text" id="DownUnitsRoomsBeds" name="NumberOfDownUnitsCount" tabindex="43">
</td>
<td colspan="2">Occupied Space:</td>
<td>
<input type="text" name="OccupiedSpaceValue" id="OccupiedSpaceText" value="" tabindex="47">
</td>
</tr>
<tr>
<td>Unit of Measurement:</td>
<td>
<select size="1" name="MeasurementUnitType" value="Unit of Measurement:" tabindex="44" onchange="addOccupiedSpaceText(); addVacantSpaceText(); addTotalUnitsRoomsBedsText(); addDownUnitsRoomsBedsText()" style="height: 22px">
<option value=""></option>
<option value="Units">Units</option>
<option value="Rooms">Rooms</option>
<option value="Beds">Beds</option>
<option value="Sq. Feet">Sq. Feet</option>
</select>
</td>
<td colspan="2">Vacant Space:</td>
<td>
<input type="text" name="VacantSpaceValue" id="VacantSpaceText" tabindex="48" ;>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2">Total Percent Occupied:</td>
<td>
<input type="text" name="PercentOccupied" value="" tabindex="49" readonly="readonly">
<button type="button" onload="calcPercentOccupied();" onclick="calcPercentOccupied();">Calculate</button>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
</table>
<p></p>
<table>
<tr class="style1">
<th># of
<br />Bedrooms</th>
<th># of
<br />Baths</th>
<th># of
<br />Units</th>
<th>Average
<br />Ft*/Unit</th>
<th>Monthly
<br />Rent</th>
<th>#
<br />Occupied</th>
<th>#
<br />Vacant</th>
<th>#
<br />Down</th>
<th>#
<br />Inspected</th>
</tr>
<tr>
<td>
<input type="text" name="MeasurementIdentifierBedroomsCount01" value="MeasurementIdentifierBedroomsCount01" tabindex="257" style="height: 19px" />
</td>
<td>
<input type="text" name="MeasurementIdentifierBathCount01" value="MeasurementIdentifierBathCount01" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementCount01" value="NumberOfMeasurementCount01" tabindex="257" onfocus="calcNumberOfMeasurementCountSum()" style="height: 19px" />
</td>
<td>
<input type="text" name="AverageSizeOfMeasurementFootage01" value="AverageSizeOfMeasurementFootage01" class="RentAVGFT" tabindex="257" />
</td>
<td>
<input type="text" name="AverageRentOfMeasurementAmount01" value="AverageRentOfMeasurementAmount01" class="RentAVGFT" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementOccupiedCount01" value="NumberOfMeasurementOccupiedCount01" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementVacantCount01" value="NumberOfMeasurementVacantCount01" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementDownCount01" value="NumberOfMeasurementDownCount01" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementInspectedCount01" value=“NumberOfMeasurementInspectedCount01 " tabindex="257 " /></td>
</tr>
<tr>
<td>
<input type="text " name="MeasurementIdentifierBedroomsCount02 " value=“MeasurementIdentifierBedroomsCount02" tabindex="257" />
</td>
<td>
<input type="text" name="MeasurementIdentifierBathCount02" value=“MeasurementIdentifierBathCount02 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementCount02 " value=“NumberOfMeasurementCount02" tabindex="257" onfocus="calcNumberOfMeasurementCountSum()" style="height: 19px" />
</td>
<td>
<input type="text" name="AverageSizeOfMeasurementFootage02" value=“AverageSizeOfMeasurementFootage02 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="AverageRentOfMeasurementAmount02 " value=“AverageRentOfMeasurementAmount02" class="RentAVGFT" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementOccupiedCount02" value=“NumberOfMeasurementOccupiedCount02 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementVacantCount02 " value=“NumberOfMeasurementVacantCount02" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementDownCount02" value=“NumberOfMeasurementDownCount02 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementInspectedCount02 " value=“NumberOfMeasurementInspectedCount02" tabindex="257" />
</td>
</tr>
<tr>
<td>
<input type="text" name="MeasurementIdentifierBedroomsCount03" v value=“MeasurementIdentifierBedroomsCount03 " tabindex="257 " /></td>
<td>
<input type="text " name="MeasurementIdentifierBathCount03 " value=“MeasurementIdentifierBathCount03" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementCount03" value=“NumberOfMeasurementCount03 " tabindex="257 " onfocus="calcNumberOfMeasurementCountSum() " /></td>
<td>
<input type="text " name="AverageSizeOfMeasurementFootage03 " AverageSizeOfMeasurementFootage03" class="RentAVGFT" tabindex="257" />
</td>
<td>
<input type="text" name="AverageRentOfMeasurementAmount03" value="AverageRentOfMeasurementAmount03" class="RentAVGFT" tabindex="257" style="height: 19px" />
</td>
<td>
<input type="text" name="NumberOfMeasurementOccupiedCount03" value="NumberOfMeasurementOccupiedCount03" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementVacantCount03" value="NumberOfMeasurementVacantCount03" tabindex="257" />
</td>
<td>
<input type="text" name="NumberOfMeasurementDownCount03" value="NumberOfMeasurementDownCount03" tabindex="257" style="height: 19px" />
</td>
<td>
<input type="text" name="NumberOfMeasurementInspectedCount03" value=“NumberOfMeasurementInspectedCount03 " tabindex="257 " /></td>
</tr>
<tr>
<td>
<input type="text " name="MeasurementIdentifierBedroomsCount04 " value=“MeasurementIdentifierBedroomsCount04" tabindex="257" />
</td>
<td>
<input type="text" name="MeasurementIdentifierBathCount04" value=“MeasurementIdentifierBathCount04 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementCount04 " value=“NumberOfMeasurementCount04" tabindex="257" onfocus="calcNumberOfMeasurementCountSum()" />
</td>
<td>
<input type="text" name="AverageSizeOfMeasurementFootage04" AverageSizeOfMeasurementFootage04 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="AverageRentOfMeasurementAmount04 " value="AverageRentOfMeasurementAmount04 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementOccupiedCount04 " value="NumberOfMeasurementOccupiedCount04 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementVacantCount04 " value="NumberOfMeasurementVacantCount04 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementDownCount04 " value="NumberOfMeasurementDownCount04 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementInspectedCount04 " value="NumberOfMeasurementInspectedCount04 " tabindex="257 " /></td>
</tr>
<tr>
<td>
<input type="text " name="MeasurementIdentifierBedroomsCount05 " value="MeasurementIdentifierBedroomsCount05 " tabindex="257 " style="height: 19px " /></td>
<td>
<input type="text " name="MeasurementIdentifierBathCount05 " value="MeasurementIdentifierBathCount05 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementCount05 " value="NumberOfMeasurementCount05 " tabindex="257 " onfocus="calcNumberOfMeasurementCountSum() " /></td>
<td>
<input type="text " name="AverageSizeOfMeasurementFootage05 " value="AverageSizeOfMeasurementFootage05 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="AverageRentOfMeasurementAmount05 " value="AverageRentOfMeasurementAmount05 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementOccupiedCount05 " value="NumberOfMeasurementOccupiedCount05 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementVacantCount05 " "NumberOfMeasurementVacantCount05 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementDownCount05 " value="NumberOfMeasurementDownCount05 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementInspectedCount05 " value="NumberOfMeasurementInspectedCount05 " tabindex="257 " /></td>
</tr>
<tr>
<td>
<input type="text " name="MeasurementIdentifierBedroomsCount06 " value="MeasurementIdentifierBedroomsCount06 " tabindex="257 " /></td>
<td>
<input type="text " name="MeasurementIdentifierBathCount06 " value="MeasurementIdentifierBathCount06 " tabindex="257 " style="height: 19px " /></td>
<td>
<input type="text " name="NumberOfMeasurementCount06 " value="NumberOfMeasurementCount06 " tabindex="257 " onfocus="calcNumberOfMeasurementCountSum() " /></td>
<td>
<input type="text " name="AverageSizeOfMeasurementFootage06 " value="AverageSizeOfMeasurementFootage06 " class="RentAVGFT " tabindex="257 " style="height: 19px " /></td>
<td>
<input type="text " name="AverageRentOfMeasurementAmount06 " value="AverageRentOfMeasurementAmount06 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementOccupiedCount06 " value="NumberOfMeasurementOccupiedCount06 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementVacantCount06 " value="NumberOfMeasurementVacantCount06 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementDownCount06 " value="NumberOfMeasurementDownCount06 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementInspectedCount06 " value="NumberOfMeasurementInspectedCount06 " tabindex="257 " style="height: 19px " /></td>
</tr>
<tr>
<td>
<input type="text " name="MeasurementIdentifierBedroomsCount07 " value="MeasurementIdentifierBedroomsCount07 " tabindex="257 " /></td>
<td>
<input type="text " name="MeasurementIdentifierBathCount07 " value="MeasurementIdentifierBathCount07 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementCount07 " value="NumberOfMeasurementCount07 " tabindex="257 " onfocus="calcNumberOfMeasurementCountSum() " /></td>
<td>
<input type="text " name="AverageSizeOfMeasurementFootage07 " value="AverageSizeOfMeasurementFootage07 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="AverageRentOfMeasurementAmount07 " value="AverageRentOfMeasurementAmount07 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementOccupiedCount07 " value="NumberOfMeasurementOccupiedCount07 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementVacantCount07 " value="NumberOfMeasurementVacantCount07 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementDownCount07 " value="NumberOfMeasurementDownCount07 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementInspectedCount07 " value="NumberOfMeasurementInspectedCount07 " tabindex="257 " /></td>
</tr>
<tr>
<td>
<input type="text " name="MeasurementIdentifierBedroomsCount08 " value="MeasurementIdentifierBedroomsCount08 " tabindex="257 " /></td>
<td>
<input type="text " name="MeasurementIdentifierBathCount08 " value="MeasurementIdentifierBathCount08 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementCount08 " value="NumberOfMeasurementCount08 " tabindex="257 " onfocus="calcNumberOfMeasurementCountSum() " /></td>
<td>
<input type="text " name="AverageSizeOfMeasurementFootage08 " value="AverageSizeOfMeasurementFootage08 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="AverageRentOfMeasurementAmount08 " value="AverageRentOfMeasurementAmount08 " class="RentAVGFT " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementOccupiedCount08 " value="NumberOfMeasurementOccupiedCount08 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementVacantCount08 " value="NumberOfMeasurementVacantCount08 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementDownCount08 " value="NumberOfMeasurementDownCount08 " tabindex="257 " /></td>
<td>
<input type="text " name="NumberOfMeasurementInspectedCount08 " value="NumberOfMeasurementInspectedCount08 " tabindex="257 " /></td>
</tr>
<tr>
<th colspan="2 ">Totals:</th>
<td><input readonly type="text " name="NumberOfMeasurementCountSum " value="NumberOfMeasurementCountSum " tabindex="409 " /></td>
<td colspan="2 "><button type="button " id="CalculateTotals " onclick="calcNumberOfMeasurementCountSum(); calcNumberOfMeasurementOccupiedCountSum(); calcNumberOfMeasurementVacantCountSum(); calcNumberOfMeasurementDownCountSum(); calcNumberOfMeasurementInspectedCountSum(); ">Calculate Totals</button></td>
<td><input readonly type="text " name="NumberOfMeasurementOccupiedCountSum " value="NumberOfMeasurementOccupiedCountSum " tabindex="410 " /></td>
<td><input readonly type="text " name="NumberOfMeasurementVacantCountSum " value="NumberOfMeasurementVacantCountSum " tabindex="411 " /></td>
<td><input readonly type="text " name="NumberOfMeasurementDownCountSum " value="NumberOfMeasurementDownCountSum " tabindex="412 " /></td>
<td><input readonly type="text " name="NumberOfMeasurementInspectedCountSum " value="NumberOfMeasurementInspectedCountSum " tabindex="413 " /></td>
</tr>
</table>
<p><input type="submit " value="Save Form " onclick="verify(); name="tbSubmit" tabindex="599" />
</p>
</form>
</body>