Why is my iframe image disappearing?

I'm still a php newbie ... I've been looking for someone with a coding problem like mine, but couldn't find what I was looking for. I apologize if I missed an identical post in any way.

I have a list of the top 10 videos (list by title). The list (which is correctly ordered and generated from the foreach loop) of headers is anchored by the header to the sample video at a specific place in the html part of the page, in particular, in an iframe. When the user clicks on the video titles, the sample YouTube video plays in the correct place without issue, even if a name is assigned in the iframe. However, once the "target" attribute (in bold) is added to the php code, referencing the "name" of the iframe, the correct video loads for about 1 second and then disappears, leaving part of my site's home page in place (iframe sizes are much less than a whole page). Here is the code:

<html>
<div id="iframe_play"> <!--Start iframe-->
<iframe name="iframe1" width="558" height="325"    
src="http://www.youtube.com/embed/MAFzWFHmXiw" frameborder="0"></iframe>
</div>
.
. //Some code
.
<td class="class1"><?php 
echo "<ol style=\"list-style:none; margin: 0; padding: 0\">";

$i = 1; 
             foreach ($videos as $video) {

                if($i>10){
                break; //Necessary to terminate loop properly
                        }

             echo "<li style=\"margin-left:20px\"><font size=2   
             style=\"color:red\">".$i."</font>"."&nbsp;&nbsp<a href=\"#null\" 
             **target=\"iframe1"** onclick=\"activatevideo();\"><font size=2 
             style=\"color:#23B223\">".substr($video['title'],0,23)."</font></a></li>";

$i++;

                   }
echo "</ol>";

?></td>

</html>

      

I should add that it would "fit" the selected sections of the page, but if for some reason I cannot achieve this, I will live without target = \ "iframe1" . Can anyone explain this disappearing sample video in iframe only when using "target"?

0


source to share





All Articles