天天看點

iframe标簽裡面的頁面元素隻讀

iframe标簽裡面的頁面元素隻讀,可以通過設定一個隻讀的透明div進行遮罩實作。

html代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style>
    .mask
    {
        position: absolute;
        width: 100%;
        height: 100%;
        z-index: 1;
        filter: alpha(opacity=0);
        opacity: 0;
        background: #ffffff;
    }
</style>
<div style="position: relative">
    <div class="mask">
    </div>
    <iframe src="http://bbs.csdn.net" width="500px" height="300px" id="ifr"></iframe>
</div>      

效果:

iframe标簽裡面的頁面元素隻讀