True or False values for JavaScript validations

Posted on 2009-04-10
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()}">

Question by:Faye_DBA
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 41

Expert Comment

ID: 24118055
anchor tags (i.e., "a") don't have a clicked attribute.  So, I think that this reference to "clicked" is to a global variable.
LVL 41

Accepted Solution

HonorGod earned 500 total points
ID: 24118079
Yeah, this demonstrates it.

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

Open in new window


Author Comment

ID: 24118090
You are correct because I found the variable that sets the value of clicked on formsubmit()

function frmPayments_onsubmit()
      clicked = 1;


LVL 41

Expert Comment

ID: 24118124
Thank you for the grade & points.

Good luck & have a Happy Easter.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
PaperPort 14.5 Patch 1 update is often not detected or downloaded automatically. This article provides direct download links to solve the problem for retail (non-bundled) versions of the Standard and Professional editions, as well as the Professiona…
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
The goal of the tutorial is to teach the user the full work flow of how to use flash media encoder to stream onto YouTube.
Suggested Courses

738 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