onmouseover/onmouseout on to zoom in images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mirkop80
Forum Newbie
Posts: 1
Joined: Mon Jun 13, 2016 11:12 pm

onmouseover/onmouseout on to zoom in images

Post by mirkop80 »

Hello,

i'm Mirko and this is my first topic.

I'm a beginner in PHP.

I'm doing some exercises and i write this code in order to view some images in rows and i put in the javascript function onmouseover and onmouseout in order to pass through the image and zoom in the image.

Code: Select all

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript">
        function zoom (chi, quanto) {
            chi.style.width = quanto +"px";
            chi.style.height = quanto +"px";
        }
    </script>
    <style>
        td {border: 1px solid red;}
        img {height: 100px; width:100px;}
        
    </style>
    <title>My</title>
</head>
<body>
    <?php
        $elencoJPG = glob("*.jpg");
        echo "<table>";
        for ($miniatura = 0; $miniatura < count($elencoJPG); ) {
            echo "<tr>";
            for ($suQuestaRiga = 0; $suQuestaRiga < 4 && $miniatura < count($elencoJPG); $miniatura++, $suQuestaRiga++) {
                echo "<td> <img id='$miniatura' src='$elencoJPG[$miniatura]'
                onmouseover ='zoom(this; 200);'
                onmouseout ='zoom(this; 100);' /> </td>";
                
            }
            echo "</tr>";
        }
        echo "</table>";
    ?>
    
    
</body>
</html>
Could someone tell me what's wrong?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: onmouseover/onmouseout on to zoom in images

Post by requinix »

The onmouseover/out code has semicolons where it should have commas,

Code: Select all

onmouseover ='zoom(this, 200);'
but otherwise it all seems reasonable enough...
Post Reply