Electronic signature javascript hairpulling madness!! Please help : )

Discussion in 'HTML & Website Design' started by Guru Grimmer, Sep 10, 2010.

  1. #1
    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
     
    Guru Grimmer, Sep 10, 2010 IP
  2. JJulian

    JJulian Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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="javascript:purchase()"><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>
     
    Last edited: Sep 10, 2010
    JJulian, Sep 10, 2010 IP
  3. JJulian

    JJulian Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    the emote got stuck in there when it wasn't supposed to please replace the <a href="javascript:purchase()"> with <a href="javascript: purchase()">
     
    JJulian, Sep 10, 2010 IP
  4. Guru Grimmer

    Guru Grimmer Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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 : )
     
    Guru Grimmer, Sep 10, 2010 IP
  5. Guru Grimmer

    Guru Grimmer Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry forgot to say, it stays on the same page when you click on the image.

    Thanks again.

    : )
     
    Guru Grimmer, Sep 10, 2010 IP
  6. Guru Grimmer

    Guru Grimmer Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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) : )
     
    Guru Grimmer, Sep 11, 2010 IP
  7. JJulian

    JJulian Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Glad you figured it out :)
     
    JJulian, Sep 11, 2010 IP