Jump to content

Switch pic and count statistics at the same time


web20

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.