SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member sunrise's Avatar
    Join Date
    Oct 2001
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Java Script Msg Box calls a PHP functions?

    How can an alert box in Java Script runs a PHP function?

    <SCRIPT LANGUAGE = "JavaScript">
    alert ("Time Out");
    start_quiz();

    </SCRIPT>

    <?php

    function start_quiz();

    ?>


  2. #2
    Sports Publisher mjames's Avatar
    Join Date
    Jan 2000
    Location
    Charlotte, NC
    Posts
    5,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have a page where you are trying this? Always include a link with your posts; it will better ensure you get a response. Good luck.

  3. #3
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It can't. PHP code is server side and is executed BEFORE the resulting HTML is sent to the browser. JavaScript is client side and executes AFTER the HTML has been recieved by the browser. you can't call a PHP function from JavaScript. If you don't understand why, you need to read more about how server side programming languages work.


Bookmarks

Posting Permissions

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