Bishop Score
by molecoder
HTML
<div class="container">
<div class="row">
<div class="col">
<form action="" id="bishopform" onsubmit="return true;">
<div>
<fieldset>
<legend>Bishop Score version 1.2.</legend>
<p>(modify one field to see the score)</p>
<div id="bishopScore"></div>
<label><b>Position</b></label><br/>
<label class='radiolabel'><input type="radio" name="selectedposition" value="Round1" onclick="calculateTotalBishop()" checked />Posterior</label><br/>
<label class='radiolabel'><input type="radio" name="selectedposition" value="Round2" onclick="calculateTotalBishop()" />Intermed.</label><br/>
<label class='radiolabel'><input type="radio" name="selectedposition" value="Round3" onclick="calculateTotalBishop()" />Anterior</label><br/>
<br/>
<label><b>Consistency</b></label><br/>
<label class='radiolabel'><input type="radio" name="selectedconsistency" value="Round4" onclick="calculateTotalBishop()" />Firm</label><br/>
<label class='radiolabel'><input type="radio" name="selectedconsistency" value="Round5" onclick="calculateTotalBishop()" />Intermed.</label><br/>
<label class='radiolabel'><input type="radio" name="selectedconsistency" value="Round6" onclick="calculateTotalBishop()" checked />Soft</label><br/>
<br/>
<label><b>Effacement</b></label><br/>
<label class='radiolabel'><input type="radio" name="selectedeffacement" value="Round7" onclick="calculateTotalBishop()" />0-30%</label><br/>
<label class='radiolabel'><input type="radio" name="selectedeffacement" value="Round8" onclick="calculateTotalBishop()" checked />31-50%</label><br/>
<label class='radiolabel'><input type="radio" name="selectedeffacement" value="Round9" onclick="calculateTotalBishop()"...
CSS
#bishopScore{
padding:10px;
font-weight:bold;
background-color:#ff0;
}
JavaScript
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////BISHOP SCORE
//Set up an associative array
//The keys represent the points
//The values represent the position i.e Posterior => 0
var position = new Array();
position["Round1"]=0;
position["Round2"]=1;
position["Round3"]=2;
//Set up an associative array
//The keys represent the points
//The values represent the consistency i.e Firm => 0
var consistency = new Array();
consistency["Round4"]=0;
consistency["Round5"]=1;
consistency["Round6"]=2;
//Set up an associative array
//The keys represent the points
//The values represent the effacement i.e 0-30% => 0
var effacement = new Array();
effacement["Round7"]=0;
effacement["Round8"]=1;
effacement["Round9"]=2;
effacement["Round10"]=3;
//Set up an associative array
//The keys represent the points
//The values represent the dilation i.e 0 cm => 0
var dilation = new Array();
dilation["Round11"]=0;
dilation["Round12"]=1;
dilation["Round13"]=2;
dilation["Round14"]=3;
//Set up an associative array
//The keys represent the points
//The values represent the fetal station i.e -3 => 0
var fetal_station = new Array();
fetal_station["Round15"]=0;
fetal_station["Round16"]=1;
fetal_station["Round17"]=2;
fetal_station["Round18"]=3;
// getPosition() finds the points based on the position.
// Here, we need to take user's the selection from radio button selection
function getPosition()
{
var positionPoints=0;
//Get a reference to the form id="bishopform"
var theForm = document.forms["bishopform"];
//Get a reference to the position the user Chooses name=selectedposition":
var selectedPosition = theForm.elements["selectedposition"];
//Here since there are 3 radio buttons selectedPosition.length = 3
//We loop through each radio buttons
for(var i = 0; i < selectedPosition.length; i++)
{
//if the...