Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2005
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Execute alert from php function

    hey gang..

    any ideas on how I could do this without the button?
    So i can execute it from calling a php function

    <form><input type=\"button\" onclick=\"alert('Done!')\" value=\"Alert\"></form>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    PHP is server side. An alert is client side. There is a difference. PHP can echo javascript but javascript CANNOT communicate with php.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Jul 2005
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sure, i understand that.

    so why would this not work?

    Code:
    echo "<script language=\"JavaScript\">alert('Done!')></script>";

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Because its an error in your part, notice the red highlight.
    Code:
    echo "<script language=\"JavaScript\">alert('Done!')></script>";
    Also you shouldn't use language="JavaScript" you should use type="text/javascript" instead.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •