Announcement

Collapse
No announcement yet.

Why doesn't this javascript work???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Why doesn't this javascript work???

    Below is some javascript to check that email addresses match.
    I have put some debug bits in to see what is going on.
    The results I get are:
    alert box "testing"
    alert box "[object HTMLInputElement]
    alert box "testing2"

    What has happened to 'email1'? (It does have content BTW)

    Mike


    <input type="text" name="INVOICEEMAIL" id="email1" size="20" maxlength="255" value="<Actinic:Variable Name="InvoiceEmail"/>" />
    <BR />
    <BR />
    <input type="text" name="DUMMY" id="email2" size="20" maxlength="255" value="<Actinic:Variable Name="InvoiceEmail"/>" />
    <script language=JavaScript>
    <!--
    function checkemailaddress()
    {
    var x=document.getElementById('email1');
    var y='testing2';
    alert('testing');
    alert (x);
    alert (y);
    if ( document.getElementById('email1').value != document.GetElementById('email2').value )
    {
    alert('The email Addresses do not match');
    return false;
    }
    alert('The email addresses match');
    return true;
    }
    // -->
    </script>
    </td>
    <a href="" onclick="return checkemailaddress()">TEST</A>
    Boy, this is a big learning curve.....and YES I've got my crampons on!
    www.shop.burns-pet-nutrition.co.uk

    #2
    Fixed it.

    Serves me right for copying and pasting instead of writing my own!!

    Mike

    <input type="text" name="INVOICEEMAIL" id="email1" size="20" maxlength="255" value="<Actinic:Variable Name="InvoiceEmail"/>" />
    <BR />
    <BR />
    <input type="text" name="DUMMY" id="email2" size="20" maxlength="255" value="<Actinic:Variable Name="InvoiceEmail"/>" />
    <script language=JavaScript>
    <!--
    function checkemailaddress()
    {
    var x=document.getElementById('email1').value;
    var y=document.getElementById('email2').value;
    alert (x);
    alert (y);
    if ( x != y )
    {
    alert('The email Addresses do not match');
    return false;
    }
    alert('The email addresses match');
    return true;
    }
    // -->
    </script>
    Boy, this is a big learning curve.....and YES I've got my crampons on!
    www.shop.burns-pet-nutrition.co.uk

    Comment

    Working...
    X