demuro1 Posted October 20, 2012 Share Posted October 20, 2012 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 More sharing options...
dsonesuk Posted October 20, 2012 Share Posted October 20, 2012 you have to declare it as a function function payNow() {alert('PayPal Button Pushed');} with this 'payNow()' on its own will calls this declared function Link to comment Share on other sites More sharing options...
demuro1 Posted October 20, 2012 Author Share Posted October 20, 2012 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 More sharing options...
dsonesuk Posted October 20, 2012 Share Posted October 20, 2012 the classic is<script type='txt/javascript'> Link to comment Share on other sites More sharing options...
demuro1 Posted October 20, 2012 Author Share Posted October 20, 2012 with no e that would be just as badoh man it makes for a funny story in class but the frustration would be unbearable Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now