Solved

True or False values for JavaScript validations

Posted on 2009-04-10
4
160 Views
Last Modified: 2012-05-06
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
Comment
Question by:Faye_DBA
  • 3
4 Comments
 
LVL 41

Expert Comment

by:HonorGod
Comment Utility
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
 
LVL 41

Accepted Solution

by:
HonorGod earned 500 total points
Comment Utility
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
 

Author Comment

by:Faye_DBA
Comment Utility
You are correct because I found the variable that sets the value of clicked on formsubmit()

function frmPayments_onsubmit()
{
      clicked = 1;

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

Thanks
0
 
LVL 41

Expert Comment

by:HonorGod
Comment Utility
Thank you for the grade & points.

Good luck & have a Happy Easter.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The standard (non-Professional) edition of PaperPort (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) from Nuance Communications (http://www.nuance.com/) (previously known as ScanSoft) is limited to five Scanning Profiles, but …
PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/). It is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) and businesses (http:/…
The goal of the tutorial is to teach the user how to import photos into Adobe Lightroom efficiently and to keep everything organized.
The goal of the tutorial is to teach the user how to use import presets downloaded from the internet into Adobe Lightroom. Once you downloaded the presets go into the preset folder and press import then import your preset and your set it to go.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now