web20 Posted February 1, 2007 Share Posted February 1, 2007 Hello, I am changing a big pic in the parentframe from an iframe. That works via javascript via changing the innerHTML of the parentframe. parent.document.getElementById ('mac').innerHTML="<img src='"+whichpic+"' alt=''>"; InnerHtml was necessary because otherwise MAC would not get the current size of the big pic and would distort it (because sizes of the big pic may vay...). So far so good. Now I have to count the clicks on the little pics in the iframe. I know how to count (in a file via php)... I know I have to somehow call something like show-and-count-pic.php?pic_name=xyz which - switches to the big pic in the parentframe and - counts (that easy) Here are the working files without counting: index.php (shows big pic) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> </head> <body> <!-- show big pic --> <p id="mac"><img src="big/001.jpg" alt="" id="pic_big" name="pic_big"></p> <iframe src="allthumbs.php" frameborder="0" scrolling="auto"> </iframe> </BODY> </HTML> allthumbs.php (shows all small pics, switches the big pic and should count) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script type="text/javascript"> function showpic (whichpic) { parent.document.getElementById ('mac').innerHTML="<img src='"+whichpic+"' alt=''>"; } </script> </head> <body> <table> <tr> <td><a onclick="showpic('big/001.jpg')"><img src="small/001.jpg"></a></td> <td><a onclick="showpic('big/002.jpg')"><img src="small/002.jpg"></a></td> </tr> </table> </body> </html> I would reeeeaaaaalllllly appreciate some answers! Thank you, Carol Link to comment https://forums.phpfreaks.com/topic/36686-switch-pic-and-count-statistics-at-the-same-time/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.