Web Analytics Made Easy -
StatCounter image pop up php - CodingForum

Announcement

Collapse
No announcement yet.

image pop up php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • image pop up php

    I am trying to embed a javascript to pop up an image into php please help when clicked nothing happens

    Code:
     <?php
    if(empty($row_Recordset1['map'])){
       //empty() returned true : so there is nothing
       echo 'Directions';
    }else{
       //empty() returned false so it is NOT true that there is nothing
       //so we can print it out:
       echo '<a href="javascript://" onClick="popupfunction(\'/images/map/' . $row_Recordset1['map'] . '\');"   class="style3">Directions</a>';
    }
    ?>

  • #2
    Please show the javascript code.
    Feel free to e-mail me if I forget to respond ;)
    [email protected]

    Comment


    • #3
      thats my problem I am an idiot and dont know how to write the code...please help if you can

      Comment


      • #4
        You can just use window.open for a simple pop-up:
        Code:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Test</title>
        <script type="text/javascript">
        // <![CDATA[
        
        function popupfunction()
        	{
        	window.open("img.jpg");
        	return false;
        	}
        
        // ]]>
        </script>
        </head>
        <body>
        
        <a href="#" onclick="return popupfunction()">pop up image</a>
        
        </body>
        </html>
        Feel free to e-mail me if I forget to respond ;)
        [email protected]

        Comment


        • #5
          but it is calling the image from a php mysql database...how would I go about doing that? with img.jpg

          Comment


          • #6
            I'm hoping you're storing the url of the image in the database and not the actual image file itself (which should be avoided). Just run a mysql request in php to grab the image url you need and echo it out. Something like this:
            Code:
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            <title>Test</title>
            <link rel="stylesheet" type="text/css" href="css/" />
            <style type="text/css">
            </style>
            <script type="text/javascript">
            // <![CDATA[
            
            function popupfunction(url)
            	{
            	window.open(url);
            	return false;
            	}
            
            // ]]>
            </script>
            </head>
            <body>
            
            <a href="#" onclick="return popupfunction('<?php echo($img) ?>')">pop up image</a>
            
            </body>
            </html>
            Feel free to e-mail me if I forget to respond ;)
            [email protected]

            Comment


            • #7
              I am using url

              Comment


              • #8
                that opened another browser window...how can I specify size of window to open with no scrolls etc....

                Comment


                • #9
                  Originally posted by sandbudd View Post
                  that opened another browser window...how can I specify size of window to open with no scrolls etc....
                  Have a look at the following website, it should be of assistance in the matter:

                  http://www.htmlcodetutorial.com/link...msupp_120.html
                  The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

                  How to ask smart questions?

                  Comment

                  Working...
                  X