#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Canada
    Posts
    35
    Rep Power
    15

    Question popup menu in javascript and php header file


    I have an index.php file that calls header.php and footer.php

    The header file opens two tables (one embedded in another) and the footer closes both.

    In header.php I try to incorporate a popup menu written in Javascript. My problem: the menu does not show at all.

    Here is my header.php file:
    ====================
    Code:
    <html>
    <head>
    <title> :: </title>
    <link rel="stylesheet" href="/style.css">
    </head>
    
    <body onload="Pop_Go()">
    
    <script type='text/javascript'>function Pop_Go(){return}</script>
    <script type='text/javascript' src='exmplpopmenu_var.js'></script>
    <script type='text/javascript' src='popmenu_com.js'></script>
    
    <!--table that will give a frame to the page--> 
    <table width="600" height="600" border="0" cellspacing="0" cellpadding="5" align="center"> 
    <tr> 
      <td class="topheader"> 
    
    <!--table that contains the header and nav bar--> 
    <table width="600" height="600" border="0" cellspacing="0" cellpadding="20" align="center"> 
        <tr> 
          <td height="100" class="header"><img src="/images/header_final.jpg" width="347" height="47"></td>
        </tr>
        <tr> 
          <td align="center" valign="middle" height="100" class="topnavbar"><BR>
            <div id='LyrOne' style='position:relative;'><a href="#"><img name="french" border="0" src="/images/french.gif" width="30" height="30"></a>&nbsp;&nbsp;| 
    <a href='#null' onmouseover="PopMenu('PopMenu1',event)" onmouseout="OutMenu('PopMenu1')">Link 1</a> | <a href='#null' onmouseover="PopMenu('PopMenu2',event)" onmouseout="OutMenu('PopMenu2')">Link 2</a> | <a href="#">About 
            Us</a> | <a href="#">Contact 
            Us</a> | <a href="/index.html">Home</a> |&nbsp;&nbsp;<a href="#"><img name="english" border="0" src="/images/english.gif" width="30" height="30"></a><BR>
            <BR></div>
          </td>
        </tr>
        <tr> 
          <td align="center" valign="middle" class="topnavbar">
    ====================

    and then footer.php:

    ====================
    Code:
    </td>
    </tr>
    </table>   
    <!--end of table that contains the header and nav bar--> 
    
    </td>
    </tr>
    </table> 
    <!--end of table that gives frame to the page--> 
    
    </body>
    </html>
    ====================

    Now I have tested the javascript code by copying header.php to a new document (header.html) and closing tables, body and html in header.html: when I test header.html on its own the popu menu shows up and works fine.

    I am brand new to javascript, I was wondering whether there is something I should be aware in mixing php and javascript? I search both these forums in here but could not find any answer...

    Thanks!
    Last edited by gac; July 16th, 2002 at 02:47 PM.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    13
    Rep Power
    0
    What does index.php look like?

    You can put:
    Code:
     alert('This is a test!');
    in your javascript to test where your javascript stops.
    If you don't get the alert, the bug is somewhere before the alert.
  4. #3
  5. No Profile Picture
    CC - Confused Coder
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Boston
    Posts
    4
    Rep Power
    0
    Yeah I had the same problem but it only happened when I started on a session on a page , the only other difference was that the script was for a formatted text box. I never really figured out what the problem was
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Canada
    Posts
    35
    Rep Power
    15
    petrik,

    index.php is so simple (just one image in its own table) for now because i am still working on the nav.

    But I did use the alert trick to figure out what is not working (thanks for the tip):

    at the beginning of my javascript document I have
    Code:
    var DomYes=document.getElementById?1:0;
    it happens that this variable does not get defined because further in one javascript function I have:
    Code:
    if(!DomYes){alert('This is a test!');}   if(DomYes){ blahblahblah;}
    and I do see the popup window 'This is a test' so that means DomYes has not been defined earlier.

    Please note that I just started learning javascript and I am trying to use a pre-made script, learning from it so please bear with me. Again I could post the question under the javascript forum but again I only have this problem when I split my page into header/index/footer in php, so...

    any clue? maybe it's wayyyyyyyy too complicated for me right now but I like to understand (kind of stuborn type of person )...I tried to look at some javascript tutorials but no luck...

    Thanks!
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    13
    Rep Power
    0
    Compare the source of index.php and the header and footer combined. If the only difference is the image remove the image..

    Does it work now?

    Look at image and debug it. Probably some wrong quotation marks.

IMN logo majestic logo threadwatch logo seochat tools logo