由於一些限制,現在的系統還不能升級使用Jquery,所以只好再回來使用iframe,雖然之前已經用到爛
但是一段時間沒用,一些小細節還是會忘記,所以還是來記錄一下吧!
<script>
在父頁中,依據父頁某個欄位的值而改變iframe中某個選單的selectedIndex.
var nowsec= document.getElementById("WDSsec").value;
if (nowsec == "no")
window.frames["WDSsecurity"].document.getElementById("encryptType"+wlan_idx).selectedIndex =0;
if (nowsec == "WEP")
window.frames["WDSsecurity"].document.getElementById("encryptType"+wlan_idx).selectedIndex =1;
if (nowsec == "WPA-PSK")
window.frames["WDSsecurity"].document.getElementById("encryptType"+wlan_idx).selectedIndex =2;
if (nowsec == "WPA-PSK/WPA2-PSK" || nowsec == "WPA2-PSK")
window.frames["WDSsecurity"].document.getElementById("encryptType"+wlan_idx).selectedIndex =3;
在父頁中,呼叫子頁(iframe)的function,WDSsecurity是iframe的名稱。
WDSsecurity.window.updateEncryptState();
從子頁面要丟值給父頁面,指定父頁面當中的元件id為mac的值為12345678
parent.document.getElementById("mac").value="12345678"
</script>
另外就是本來異想天開的,想要讓父頁面中的二個iframe直接互丟值,但似乎不行,所以只能先將A iframe的值先傳到父頁,再從父頁面去設定給B iframe。