What Is Wrong With This?

Discussion in 'JavaScript' started by snotb4ll, Feb 16, 2010.

  1. #1
    Hello,

    I cannot figure out what is wrong in this code. Everything after this code turns black in dreamweaver. When I removed this code everything turns to it's correct color and works. So something in this code must be missing.

    Here is the code.

    $html_head = <<<EOT
    <script language="javascript" src="inc/jsfuncs.js"></script>
    <script type="text/javascript" src="inc/ajax.js"></script>
    <script type="text/javascript">
    var ajax = new sack();

    function validateTaf(form) {
    var e = form.elements, m = '';
    if(!e['yourname'].value) {m += '- Your Name is required.\\n';}
    if(!e['youremail'].value) {m += '- Your Email is required.\\n';}
    if(!e['friendemail'].value) {m += '- Friend Email is required.\\n';}
    if(m) {
    alert('The following error(s) occurred:\\n\\n' + m);
    return false;
    }
    return true;
    }
    </script>
    EOT;
     
    snotb4ll, Feb 16, 2010 IP
  2. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #2
    var e = form.elements, m = '';
    PHP:
    should be

    var e = form.elements;m = '';
    PHP:
     
    n3r0x, Feb 16, 2010 IP
  3. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #3
    wrong. it's fine as it is, try it in your console. what you suggest he does is BAD as it breaks scope.

    there are no syntax errors here so it must be to do with the 2 js files that it's referencing - i presume you have sack defined elsewhere? can't really tell w/o looking, provide a url or something. ensure the path to the includes is fine and they are being loaded, that 'sack' is fine as a class/function
     
    dimitar christoff, Feb 17, 2010 IP
  4. Sushruta

    Sushruta Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Chris,

    Why aren’t you replying to me ? I’ve sent you several emails but you didn’t bother to reply any of them.I didn’t ask for anything illegal or that’s not legit.Paypal suggested me to refund you the money & ask you to send it again so that they can verify that the payment is Unauthorized or not.

    I’m not asking you to pay more than that what you have earlier sent me.It’s the same amount of $50 which i need to refund you back so that you can send me again.

    PLEASE FOR GOD’S SAKE REPLY.I URGENTLY NEED SOME MONEY FOR MY KIDNEY TREATMENT.IF YOU DON’T BELIEVE , JUST LET ME SEND YOU ALL THE MEDICAL DOCUMENTS.SO THAT YOU WOULD BELIEVE ME HOW MUCH I’M IN NEED FOR MONEY.

    Please reply.Please.Thanks for your understanding.

    Sushruta Bhattacharya

     
    Sushruta, May 9, 2010 IP