Hi there, I'm having some troube getting an image to be clickable when using Javascript. What I am trying to do is have a check box as an electronic signature. I have the script to do the href (link) as a simple button with text on, but I want to make it an image instead, I've spent 3- 4 hours trying to find out how to do it and have tried messing with it to see what would happen and I think I git close. Here's where I am so far - HEAD - <script language="JavaScript"> function purchase() { if (window.document.the_form.question.checked == true) { document.location.href = "http://1.xxxxxxxxxx.pay.clickbank.net"; } else { alert("Please Check the Box to Signify Agreement of Our Terms of Use."); } } </script> BODY - <form name="the_form"> <p align="center"><input name="question" value="ON" type="checkbox"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">I have Read and Agree to the <a target="_blank" href="http://www.gurugrimmer.com/Leg%20Dox%20good%20HHME/TermsofUse_and_All_Disclaimers.html">Purchase Agreement</a> Terms. </font></p> <p align="center"> <input value="img" src="add-2-cart-big.jpg" alt="ADD TO CART" onclick="purchase();" height="64" type="image" width="400"></p> If any of you awesome chaps can see what's wrong with that, I'd be very grateful. The original coding before I messed with it was. HEAD - <script language="JavaScript"> function purchase() { if (window.document.the_form.question.checked == true) { document.location.href = "YOUR-URL-HERE"; } else { alert("Please Check the Box to Signify Agreement of Our Terms of Use."); } } </script> BODY- <form name = "the_form"> <P align=center> <input type = "checkbox" name = "question" value="ON"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">I have Read and Agree to the <a target="_blank" href="URL-OF-YOUR- AGREEMENT-HERE">Purchase Agreement</a> Terms. </font></P> <P align=center> <input type = "button" value = "WHAT-YOU-WANT-THE- BUTTON-TO-SAY-HERE" onclick = "purchase();"></P> <P> </P> </form> for any of you that don't know how to do electronic signatures - that is very useful information!! : ) Matthew - aka Guru Grimmer
Give this a shot: <head> <script language="JavaScript"> function purchase() { if (window.document.the_form.question.checked == true) { window.navigate("http://1.xxxxxxxxxx.pay.clickbank.net"); } else { alert("Please Check the Box to Signify Agreement of Our Terms of Use."); } } </script> </head> <body> <form name="the_form"> <p align="center"><input name="question" value="ON" type="checkbox"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I have Read and Agree to the <a target="_blank" href="http://www.gurugrimmer.com/Leg%20Dox%20good%20HHME/TermsofUse_and_All_Disclaimers.html">Purchase Agreement</a> Terms. </font></p> <p align="center"><a href="javascripturchase()"><img src="add-2-cart-big.jpg" height="64" width="400" alt="ADD TO CART" title="ADD TO CART" border="0"></a> </p> </form> </body> </html>
the emote got stuck in there when it wasn't supposed to please replace the <a href="javascripturchase()"> with <a href="javascript: purchase()">
Hey there, Tried what you said Julian, and it didn't work, it shows a little pop up box in the bottom left corner saying javascript: purchase() Image looks lovely though. : ) I think you were pretty close with that one; got any more ideas chap? Thanks again, that was great of you. Matthew : )
Hey mate!! Did some wiggling with the idea you gave me, changed the head section to <script language="JavaScript"> function purchase() { if (window.document.the_form.question.checked == true) { document.location.href = "YOUR-URL-HERE"; } else { alert("Please Check the Box to Signify Agreement of Our Terms of Use."); } } </script> instead and kept your idea on the body ... woalah!!!! Now we're both in the know on that one then. Thanks for your help with that one mate. Now I'll have only spent 5-6 hours on this problem, rather than like 3 days. hahahaha Cheers man. Take care. Matt (Guru Grimmer) : )