what's the problem here?

Discussion in 'Java Script/AJAX' started by morris, Sep 2, 2007.

Remove these ads by signing in
Remove these ads by signing in
Thread Status:
Not open for further replies.
  1. morris New Member

    Member Since:
    Aug 31, 2007
    Message Count:
    65
    Likes Received:
    0
    Hi, i have a code in javascript that run's well.... the file has the extension ".htm". I renamed the file to ".php" and i echo-ed all the lines, to work under php.... but i'm getting this error : 'Object expected' Line 1, Char 1. My first lines are:

    '<?php
    echo "<SCRIPT language=\"JavaScript\">";
    echo "<!--";
    echo "var f = 0;";
    echo "function addInput () ";
    echo "{";
    ............
    '
    So what's the problem here?
    Thanks a lot
  2. edmond New Member

    Member Since:
    Aug 31, 2007
    Message Count:
    85
    Likes Received:
    0
    I have a hunch that your code is doing the reverse of what is acceptable with code between javascript and php.

    Javascript is client side scripting
    PHP is server side scripting

    Javascript is dynamic where as php is static i believe.

    You can output a php statement such as


    email_list[0] = "<?php echo $email_list[0]; ?>";

    the first array is in javascript the second array with a dollar sign is in php
    they are separate

    email_list[0] = "<?php echo $email_list[0]; ?>";

    maybe you need to output a php statement from javascript and not output javascript statemtns from php


    i woudl suggest rearranging your code so that the tags encapsulate your php code and your java script code assigns values based on your php echo statements which will be embedded in your javascript statements with the tag identifiers.

    good luck
Thread Status:
Not open for further replies.

Share This Page