troubleshooting Question

tying onclick event to a java function

Avatar of Natchiket
NatchiketFlag for United Kingdom of Great Britain and Northern Ireland asked on
8 Comments1 Solution245 ViewsLast Modified:
Hi experts, this should be an easy one

All I'm trying to do is run a function when someone clicks on a button, and I don't want to have to embed the function in the INPUT tab

<SCRIPT language="Javascript">
Function cmdSearch_Click()
Alert("I was clicked")

<H1>Search Facility</H1>
<FORM Name="frmSearch">
Enter the Surename:
<INPUT TYPE="Text" Name="txtName" Size=10><INPUT Type="Button" Name="cmdSearch" VALUE="Search">

So when I click on cmdSearch nothing happens

if I change the INPUT tag thus

<INPUT Type="Button" Name="cmdSearch" VALUE="Search" onclick=cmdSearch_Click()>

I get Error on page :(

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros