Jump to content

onclick and img tag trouble


demuro1

Recommended Posts

Basically I want to click on an image and have an onclick call a javascript function. It does not work. I have successfully done this with an alert but if I move the alert to a function it stops working. thanks for any help you can provide these first two pieces are what I am trying to do.

<script type='text/javascript'>			  		  payNow()			   {				    alert('PayPal Button Pushed');			   }			    </script>

<img src="images/navigationImages/paypal.gif" onclick="payNow()">

this works

<img src="images/navigationImages/paypal.gif" onclick="alert('PayPal Button Pushed')">

Link to comment
Share on other sites

damn it how did I miss that. I know you need to declare it as a function. Damn sorry, thanks! at least I'm not as bad as one guy in my class. his script rage looked like this

<script type='text/javascrip'>

he forgot the t in javascript, he recoded his assignment 4 times before he caught the mistake Thanks so much again!!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...