Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

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
0
Faye_DBA
Asked:
Faye_DBA
  • 3
1 Solution
 
HonorGodCommented:
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
 
HonorGodCommented:
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
 
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
 
HonorGodCommented:
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.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now