True or False values for JavaScript validations

What does the following code mean?
on click (if the button was not clicked?), is this contradicting itself?

<a href="#" ID="btnCalculate" NAME="btnCalculate" onclick="if(clicked == 0){CalculateAllPayments()}">

Thanks
Faye_DBAAsked:
Who is Participating?
 
HonorGodSoftware EngineerCommented:
Yeah, this demonstrates it.

Change the value of "clicked" to true, or false, and click on the "here' link
<html>
<body>
 
<script type='text/javascript'>
var clicked = false
</script>
 
<a href="#" onclick="alert(clicked)">here</a>
 
</body>
</html>

Open in new window

0
 
HonorGodSoftware EngineerCommented:
anchor tags (i.e., "a") don't have a clicked attribute.  So, I think that this reference to "clicked" is to a global variable.
0
 
Faye_DBAAuthor Commented:
You are correct because I found the variable that sets the value of clicked on formsubmit()

function frmPayments_onsubmit()
{
      clicked = 1;

...............

Thanks
0
 
HonorGodSoftware EngineerCommented:
Thank you for the grade & points.

Good luck & have a Happy Easter.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.