使用方框并排获得iFrame

时间:2013-11-03 21:11:20

标签: iframe

我的困境是,我想要左边的方框和iframe与五个方框并排放下,我不确定如何去做。这是我的代码;

<script>
function clock()
{
setInterval(
function(){
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
var box1 = document.getElementById("box1");
var box2 = document.getElementById("box2");
var box3 = document.getElementById("box3");
var box4 = document.getElementById("box4");
var box5 = document.getElementById("box5");

switch(m % 10)
{
    case 0:
        box1.style.backgroundColor = "#34db00";
        box2.style.backgroundColor = "#ffc000";
        box3.style.backgroundColor = "#0093ff";
        box4.style.backgroundColor = "#0093ff";
        box5.style.backgroundColor = "#0093ff";
        break;
    case 1:
        box1.style.backgroundColor = "#0093ff";
        box2.style.backgroundColor = "#34db00";
        box3.style.backgroundColor = "#ffc000";
        box4.style.backgroundColor = "#0093ff";
        box5.style.backgroundColor = "#0093ff";
        break;
    case 2:
        box1.style.backgroundColor = "#0093ff";
        box2.style.backgroundColor = "#0093ff";
        box3.style.backgroundColor = "#34db00";
        box4.style.backgroundColor = "#ffc000";
        box5.style.backgroundColor = "#0093ff";
        break;
    case 3:
        box1.style.backgroundColor = "#0093ff";
        box2.style.backgroundColor = "#0093ff";
        box3.style.backgroundColor = "#0093ff";
        box4.style.backgroundColor = "#34db00";
        box5.style.backgroundColor = "#ffc000";
        break;
    case 4:
        box1.style.backgroundColor = "#ffc000";
        box2.style.backgroundColor = "#0093ff";
        box3.style.backgroundColor = "#0093ff";
        box4.style.backgroundColor = "#0093ff";
        box5.style.backgroundColor = "#34db00";
        break;
    case 5:
        box1.style.backgroundColor = "#34db00";
        box2.style.backgroundColor = "#ffc000";
        box3.style.backgroundColor = "#0093ff";
        box4.style.backgroundColor = "#0093ff";
        box5.style.backgroundColor = "#0093ff";
        break;
    case 6:
        box1.style.backgroundColor = "#0093ff";
        box2.style.backgroundColor = "#34db00";
        box3.style.backgroundColor = "#ffc000";
        box4.style.backgroundColor = "#0093ff";
        box5.style.backgroundColor = "#0093ff";
        break;
    case 7:
        box1.style.backgroundColor = "#0093ff";
        box2.style.backgroundColor = "#0093ff";
        box3.style.backgroundColor = "#34db00";
        box4.style.backgroundColor = "#ffc000";
        box5.style.backgroundColor = "#0093ff";
        break;
    case 8:
        box1.style.backgroundColor = "#0093ff";
        box2.style.backgroundColor = "#0093ff";
        box3.style.backgroundColor = "#0093ff";
        box4.style.backgroundColor = "#34db00";
        box5.style.backgroundColor = "#ffc000";
        break;
    case 9:
        box1.style.backgroundColor = "#ffc000";
        box2.style.backgroundColor = "#0093ff";
        box3.style.backgroundColor = "#0093ff";
        box4.style.backgroundColor = "#0093ff";
        box5.style.backgroundColor = "#34db00";
        break;            
    default:
        box1.style.backgroundColor = "#0093ff";
        box2.style.backgroundColor = "#0093ff";
        box3.style.backgroundColor = "#0093ff";
        box4.style.backgroundColor = "#0093ff";
        box5.style.backgroundColor = "#0093ff";
}
}, 1000);   
}

clock();
</script>


<style media="screen" type="text/css">

div 
{
width:30%; 
height:19.242%; 
background-color:#0093ff;  
border-radius:25px;
}
</style>






<div id="box1"></div>
<div id="box2"></div>
<div id="box3"></div>
<div id="box4"></div>
<div id="box5"></div>



<iframe src="https://www.google.co.uk/" name="iframe1" align="right" width="69%"  height="600"></iframe>

然后显示为左下方的5个框,但是iframe位于右侧下方,而不是右侧框的侧面。我怎么能让它们并排?感谢。

0 个答案:

没有答案