<style>
iframe{position:absolute;width:200;height:200;fason:expression(this.style.left=(screen.width-this.offsetWidth)/2)}
</style>

解决方案 »

  1.   

    <style>
    iframe{position:absolute;width:200;height:200;fason1:expression(this.style.left=(document.body.clientWidth-this.offsetWidth)/2);fason2:expression(this.style.top=(document.body.clientHeight-this.offsetHeight)/2)}
    </style>
      

  2.   

    不行,滚动条滚动后,iframe不在中间了.
      

  3.   


    <body onscroll="a1.style.top=document.body.scrollTop">
    <div id=a1 style="position:absolute"><iframe src="1.htm"></iframe></div>
    <p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
    </body>
    <body onscroll="a1.style.top=document.body.scrollTop">
    <div id=a1 style="position:absolute"><iframe src="1.htm"></iframe></div>
    <p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
    </body>把位置修改成fason(阿信) 所说的就可以了
      

  4.   

    to fason:expression本来就是钟对css的所有属性的把fason1:expression(this.style.left=(document.body.clientWidth-this.offsetWidth)/2);
    fason2:expression(this.style.top=(document.body.clientHeight-this.offsetHeight)/2);写成下面的样子更简洁left:expression((document.body.clientWidth-this.offsetWidth)/2);
    top:expression((document.body.clientHeight-this.offsetHeight)/2);