Take notice to the id ('Q1T' and 'Q1F') which stands for "Question One True" and "Question One False". Okay, they both have the same name property so that you can only select one or the other. Ok, Ok, enough of the html refresher...
yup, so when the button is clicked, the "CheckQ1" or "Check Question One" function that is written in a separate .js file will run...
This one works:
function CheckQ1()
{
var rButtonT = document.getElementById('Q1T');
alert(rButtonT.checked);
}
When the true option is selected the alert says true and when the false option is selected the alert says false. Well, then why does the following script give me unexpected results...
fucntion CheckQ1()
{
var rButtonT = document.getElementById('Q1T');
if (rButtonT.checked = true)
{
var Answer = document.getElementById('Answer1');
Answer.appendChild(document.createTextNode('The Answer Is Correct'))
}
}
The 'Answer1' id is a <tr id='Answer1'> which sits empty until the "Enter" button is clicked. Well, what happens is that no matter what option that I select, the "True" option automatically gets selected and the text: "The Answer Is Correct" gets written to the table row.
hmmmmm, not sure what is going on here. If someone could help me out, I'll sure appreciate it...
Bookmarks