SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help on echoing a javascript function

    i am echoing some tables everything worked but then i wanted to add rollover buttons instead of plain buttons to make it look cooler, but when you have a javascript function that uses double and single quotes thats inside a bigger quote it gets confusing...i commented out the the quotes that would interupt the echo "" quotes like this \" but it still doesnt work. Anyways this is the code:

    PHP Code:
    <?php
            $result 
    mysql_query("SELECT image, ID FROM portfolio_interactive"); 
            while(
    $row mysql_fetch_assoc($result)) 
            { 
                echo 
    "<table width='432' border='0' cellpadding='0' cellspacing='0' background='image_back.gif'>
      <tr>
        <td height='25'>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><div align='right'><img src='port_images/"
    .$row["image"]."' width='75' height='75' /></div></td>
        <td><a href='delete-inter.php?id="
    .$row["ID"]."&page=admin.php' onmouseout='MM_swapImgRestore()' onmouseover=\"MM_swapImage('Image1','','remove_over.gif',1)\"><img src='remove_up.gif' name='Image1' width='121' height='43' border='0' id='Image1' /></a></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height='25'>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>"

            } 
    ?>
    my problem lies here:
    PHP Code:
    "
    <a href='delete-inter.php?id="
    .$row["ID"]."&page=admin.php' onmouseout='MM_swapImgRestore()' onmouseover=\"MM_swapImage('Image1','','remove_over.gif',1)\"><img src='remove_up.gif' name='Image1' width='121' height='43' border='0' id='Image1' />" 
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you should be able to find the problem.

    either your getting a parse error, in which case php will give you the line it occured on, or its outputting, in which cas you can look at the html output and see what doesnt look right, and then look at that part of your php code.

  3. #3
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well its very strange theres no php error coming up and when i view the source code it looks exactly like it should....the buttons still work but no rollover?

    if you would like to see for yourself REMOVED FOR SAFETY

    Off Topic:

    i just realised i have another problem lol....how can i password protect this page? lol
    Last edited by halfasleeps; Mar 28, 2006 at 13:12.
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try making the rollover work with just plain html, no php.

    then compare that, to the html output of your php script, and you will see they are probably not the same.

    when your trying to debug code, you need to first isolate the problem. if you do this is steps, eliminating things, most of the time you can find your own answers.

  5. #5
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i found the error....its because if it were only 1 table it would work (why it took me so long to find the problem) and if it were multiple tables like it is the javascript code would change too it wouldnt just be repeated.
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  6. #6
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Try using CSS for the rollover images. It's not that difficult once you get the idea and principle. It also avoids any javascript/php conflicts and quote haphazzardnous (is that a word?)
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •