Hi
I'm calling a javascript function from an asp.net page. The function pops a confirmation box with some information:
I have the following .net control:
For some reason, even when I select "Yes" on the radio button list and hit my continue button, the code in my if statement doesn't get executed - hence leaving my 'points' variable with a value of 0. If however I change it to != "Yes", it works. Can anyone see what's wrong with the syntax?!
Thanks very much in advance.
Matt
Brighton, UK
I'm calling a javascript function from an asp.net page. The function pops a confirmation box with some information:
Code:
btnContinue.Attributes.Add("onClick", "score();")
Code:
function score(){
//Calculate the score
var points = 0;
if(document.getElementById("rblFullNameGiven").Value == "Yes"){
points = points + 1;
}
return window.confirm('Points: ' + points);
return;
}
I have the following .net control:
Code:
<asp:radiobuttonlist id="rblFullNameGiven" runat="server" Width="88px" RepeatDirection="Horizontal">
<asp:ListItem Value="Yes">Yes</asp:ListItem>
<asp:ListItem Value="No">No</asp:ListItem>
</asp:radiobuttonlist>
For some reason, even when I select "Yes" on the radio button list and hit my continue button, the code in my if statement doesn't get executed - hence leaving my 'points' variable with a value of 0. If however I change it to != "Yes", it works. Can anyone see what's wrong with the syntax?!
Thanks very much in advance.
Matt
Brighton, UK