Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javacript inside onClick event 1

Status
Not open for further replies.

tmcneil

Technical User
Joined
Nov 17, 2000
Messages
294
Location
US
I have some javascript written inside the onClick event of a button of an asp page.

Code:
onClick='if (!checkSpelling(message)) alert ("User clicked cancel!");' "Submit('Generate');"

The if statement works fine by itself, however, my Submit('Generate'); never gets called. The Submit('Generate'); used to run fine by itself. Is there something wrong with my syntax?

Todd
 
It was a problem with your choice of quotes. This ought to work as expected:
Code:
<div onclick="if (!checkSpelling(message)) alert('User clicked cancel!');Submit('Generate');">...</div>

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
BabyJeffy,

The syntax fixed the problem. Now onto making sure my Generate does not get called if the user cancelled the spellchecker.

Thanks,
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top