麻烦在Iframe中使用图片

时间:2013-07-27 23:22:58

标签: html css margin padding

我在使用iframe时遇到了一些麻烦。所以基本上我试图创建一个幻灯片,其中一个幻灯片是一个嵌入式视频,所以我通过使用iframe来做到这一点。好吧,幻灯片放映功能正常,视频大小调整正确,但当图像幻灯片出现时,它们不像视频那样放大到iframe的大小,并且它们似乎有2或3px的填充在左上/右侧。我已经附上了HTML和CSS代码,并拍了一些照片来说明我想说的是什么,如果有人看到问题,我真的很感激一些帮助。非常感谢!

Correct Size Incorrect position

CSS代码

#imageDiv {
border: 5px solid black;
width:500px;
}
#slideshowImg {
width:500px;
height:300px;
margin:0px;
border-spacing:20px;
}
#mediaMenu table {
font-size:14px;
border:0;
margin-top:5px;
border-spacing:0;
}
table {
margin:0;
padding:0;
border-spacing:0
}
#mediaMenu td {
margin:0px;
padding:0px;
width:120px;
height:20px;
color:#CBE8E8;
}
.subMenu img {
width:100%;
height:100px;
}
.subTitle {
font-family:chalkboard, sans-serif;
background-color:#000;
font-size:12px;

}
.subTitle a {
color:#CBE8E8;
text-decoration:none;
}

HTML CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> ******* </title>
<link rel="stylesheet" type="text/css" href="" />
<script language="javascript" type="text/javascript">
slideshowImages = new Array(5);
slideshowImages[0] = new Image();
slideshowImages[0].src = 'images/tebowFinal.jpg';
slideshowImages[1] = new Image();
slideshowImages[1].src = 'images/nash.jpg';
slideshowImages[2] = new Image();
slideshowImages[2].src = 'images/kobe.jpg';
slideshowImages[3] = new Image();
slideshowImages[3].src = 'http://www.youtube.com/embed/9UlmwcEIWUw';
slideshowImages[4] = new Image();
slideshowImages[4].src = 'images/tbrown.jpg';
index=0;
function slideShow(source)
{
document.getElementById('slideshowImg').src = slideshowImages[source].src;
clearInterval(newPic);
index=source;
imageChange();
if (source=="3")
        {
            onclick=clearInterval(newPic);
        }
}
function slideshowForward() 
{
// increase the value of index by one or reset the value to 0 if all the slides have been cycled
index++;    
if(index >= 5) 
{
    index=0;
}
// set the image name to the slide show image
document.getElementById('slideshowImg').src = slideshowImages[index].src;
}
function imageChange() {
    newPic=setInterval(function(){slideshowForward() },5000);
}

</script>
<link href="slideshow.css" rel="stylesheet" type="text/css" />
</head>

<body onload="imageChange()">

<div id="imageDiv">
<table id="mediaMenu">
    <tr>
        <td id="imageRow" colspan="5" >
            <a href="#" onclick="clearInterval(newPic)">
            <iframe id="slideshowImg"  src="images/tebowFinalFinal.jpg" frameborder="0" scrolling="no" ></iframe>
            </a>
        </td>
    </tr>
    <tr>
        <td class="subMenu">
            <a href="#" onclick="slideShow(0)">
            <table> 
                <tr> <td class="subTitle"> Tebow Talks </td></tr>
                <tr><td><img src="images/tebow.jpg" alt="Tim Tebow"></img></td></tr> 
            </table>
            </a>
        </td>
        <td class="subMenu">
            <a href="#" onclick="slideShow(1)">
            <table>
                <tr> <td class="subTitle">Nash attack </td></tr>
                <tr><td><img src="images/nash.jpg" alt="Steve Nash"></img></td></tr>
            </table>
            </a>
        </td>
        <td class="subMenu">
            <a href="#" onclick="slideShow(2)">
            <table>
                <tr> <td class="subTitle">Kobe Who? </td></tr>
                <tr><td><img src="images/kobe.jpg" alt="Kobe Bryant"></img></td></tr>
            </table>
            </a>
        </td>
        <td class="subMenu">
            <a href="#" onclick="slideShow(3)">
            <table>
                <tr> <td class="subTitle">Not So Giant </td></tr>
                <tr><td><img src="images/giants.jpg" alt="San Francisco Giants"></img></td></tr>
            </table>
            </a>
        </td>
        <td class="subMenu">
            <a href="#" onclick="slideShow(4)">
            <table>
                <tr> <td class="subTitle">Expensive mistake </td></tr>
                <tr><td><img src="images/tbrown.jpg" alt="Terrell Brown"></img></td></tr>
            </table>
            </a>
        </td>
    </tr>
</table>                 

</div>
</body>
</html>

0 个答案:

没有答案