I am not able to pull through a set of text if the checkbox is checked. JS and HTML below... Prob a simple fix - but I am lost that this is not functioning.
//js
function getTrainerExp()
{
var trainerexp="None";
//Get a reference to the form id="courseform"
var theForm = document.forms["courseform"];
//Get a reference to the checkbox id="includeexp"
var includeexp = theForm.elements["includeexp"];
//If they checked the box set trainerexp to ACMEEXP
if(includeExp.checked==true)
{
trainerexp="ACMEXP";
}
//return the trainer expenses
return trainerexp;
}
function calculateExp()
{
var expense = getTrainerExp () ;
//display the result
var divobj = document.getElementById('trainerexp').checked;
divobj.style.display='block';
divobj.innerHTML = "Please Include " +expense;
}
HTML
<p>
<label for='includeexp' class="inlinelabel">If course delivery is at customer site include trainer travel costs and expenses</label>
<input type="checkbox" id="includeexp" name='includeexp' onclick="calculateExp()" />
</p>
<div id="trainerexp"></div>
Aucun commentaire:
Enregistrer un commentaire