#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    France
    Posts
    13
    Rep Power
    0
    HI,
    i want to use PhP and JavaScript (for event) on the same page but it doesn't work !
    when i put the PhP's code before body tag the PhP code works but not the JavaScript Event code (onunload or onload)
    and if i put body tag with javascript in then the PhP'code,The JavaScript works, the PhP generate well the page but it does'nt work bye example i do frames with my PhP code the code in source is right but i have'nt got not frame on my page !!!!
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    9
    Rep Power
    0
    Hi Bixy,

    it seems that you don't understand certain things right.

    See it like this: PHP3 only GENERATES files. Whatever is in the file (HTML/JavaScript/or whatever) doesn't matter! If a JavaScript-script doesn't work, that hasn't got anything to do with the fact that it was created by a PHP3 script!

    BTW: if you need help with JavaScript, ask it!

    Bye

    Marc aka Foddex

    ------------------
    ++++++++++++++++++++++++++++++++++++++++
    ceterum censeo linguam c++ esse delendam
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    France
    Posts
    13
    Rep Power
    0
    look my code:
    <SCRIPT LANGUAGE="JavaScript">
    /* (say only salut)*/
    function cleanup()
    {
    alert('salut');
    }
    /* end of script */
    </SCRIPT>
    <TITLE> PhPForum </TITLE>
    <META NAME="Author" CONTENT="BiXy">
    <META NAME="Keywords" CONTENT="Forum">
    <META NAME="Description" CONTENT="Forum Fait en PhP">
    <HTML>
    <?
    require('config.inc');
    if($txtnom=="")
    {
    //if no name enter echo "The name is no goodn";
    echo "$retournomn";
    }
    else
    {
    //Select the index
    $sqlstr="SELECT ind FROM listnom WHERE nom='$txtnom'";
    mysql_connect($serverhost,$user,$pass);
    $result=mysql_db_query($database,$sqlstr);
    $nbr=mysql_num_rows($result);
    mysql_close;
    if ($nbr!=0)
    {
    //if name is already use echo "Le nom $txtnom already usen";
    echo $retournom."n";
    }
    else
    {
    //create frame echo "<FRAMESET ROWS="100%,0%">n";
    echo "<FRAME SRC="frame_ve.php3?txtdir=$txtdir&txtnom=$txtnom" NAME="main_frame"> <!-- main Frame -->n";
    echo "<FRAME SRC="nom.php3" NAME="null"> <!-- Frame null -->n";
    echo "</FRAMESET>n";
    }
    }
    ?>

    </HTML>
    <BODY BGCOLOR="#FFFFFF">
    </BODY>

    $retounom is HTML meta commande to reload the page where you choose your name

    if you don't understand something ask me (i'm french)
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    France
    Posts
    13
    Rep Power
    0
    with this code the Frames work but no alertbox apear! But if i play with the BODY tag position i got the invert JAVASCRIPT work and i got no frame ?!?
    i cannot understand (maybe there is something that i don't know in HTML TAG ???)

    Thanx for you answer
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    France
    Posts
    13
    Rep Power
    0
    oh excuse i forgot to explain to you something:
    in config.inc there are only some var which i use to config connection to MySQL server
    (so the problem cannot be here)

    again thanx
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    France
    Posts
    13
    Rep Power
    0
    OUps!!!

    the code is not the good one.
    sur the JAVASCRIPT will not work i don't put:
    onload="cleanup();"
    in Body tag (but the probleme still here!)
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    9
    Rep Power
    0
    Hi Bixy

    would you please give me a html file as generated by this particular script? Maybe then I can see what's wrong...

    Bye,

    Marc aka Foddex

    ------------------
    ++++++++++++++++++++++++++++++++++++++++
    ceterum censeo linguam c++ esse delendam
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    France
    Posts
    13
    Rep Power
    0
    MouArf !!
    I found it !
    the error is just a HTML Error:
    i try to insert frame between BODY tag (that don't work of course)
    you cannot insert frame when the page have a BODY and i need a body to insert JavaScript Event so i found another solution

    Thanx for your help, if you need me just call

IMN logo majestic logo threadwatch logo seochat tools logo