關於Iframe的onfocus,IE5~8


        <input id="mytext" type="text" size="10" value="Hello!" onfocus="setbgColor('yellow')"
            onblur="setbgColor('white')" />
        <script type="text/javascript">
            
            function setbgColor(c) {
                document.getElementById("mytext").style.backgroundColor = c;
            }
            function big() {
                //alert("onfocus");
                document.getElementById("MyFrame").style.width = "200px";
                //..................................................document.getElementById("MyFrame").blur();
            }
            function small() {
                //alert("onblur");
                document.getElementById("MyFrame").style.width = "150px";
            }
            function fun1() {
                //document.getElementById("mytext").focus();
                document.getElementById("MyFrame").blur();
                //document.getElementById("MyFrame").focus();
            }
            function fun2() {
                //document.getElementById("mytext").focus();
                //document.getElementById("MyFrame").blur();
                document.getElementById("MyFrame").focus();
            }
        </script>
        <iframe id="MyFrame" src="WebForm2.aspx" width="150px" frameborder="1" height="150px"
            style="border: 1px solid black; position: absolute; top: 150px; left: 150px;"
            onfocus="big()" onblur="small()"></iframe>
        <input style="width:100px; height:30px;" value="fun1" type="button" onclick="fun1()" />
        <input style="width:100px; height:30px;" value="fun2" type="button" onclick="fun2()" />
    </div>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章