JS實現重新整理iframe的方法

2021-08-27 09:47:42 字數 1409 閱讀 8287

對於如下乙個 iframe,用 js 有什麼麼方法可以重新整理它呢:

html**

<

iframe

src="1.htm"

name="ifrmname"

id="ifrmid"

>

iframe

>

方法一、location.reload()

根據定位 iframe 的方式不同,有以下方法:

1. 用iframe的name屬性定位

html**

<

input

type="button"

name="button"

value="button"

onclick="document.frames('ifrmname').location.reload()"

> 或

html**

<

input

type="button"

name="button"

value="button"

onclick="document.all.ifrmname.document.location.reload()"

>

2. 用iframe的id屬性定位

html**

<

input

type="button"

name="button"

value="button"

onclick="ifrmid.window.location.reload()"

>

方法二、window.open()

html**

<

input

type="button"

name="button"

value="button"

onclick="window.open(document.all.ifrmname.src,'ifrmname','')"

>

該方法尤其適用於 iframe 的 src 為其它**位址,即跨域操作的情況。

方法三、給 src 屬性重新賦值

html**

<

input

type="button"

name="button"

value="button"

onclick="ifrmid.src=ifrmid.src"

> 方法

四、給 href 屬性重新賦值

html**

<

input

type="button"

name="button"

value="button"

onclick="ifrmid.location.href=ifrmid.src"

>

**:

JS實現重新整理iframe的方法

b 方案一 用iframe的name屬性定位 b 或 b 方案二 用iframe的id屬性定位 b b 終極方案 當iframe的src為其它 位址 跨域操作時 b 怎樣才重新整理showmodaldialog和showmodelessdialog裡的內容?reload.將filename.htm替...

JS實現頁面重新整理的方法

測試頁面 重新整理方法一 function fresh 方法二 function fresh 方法三 function fresh 方法四 function fresh 方法五 function fresh 方法六 只能在ie下可以執行 function fresh 方法七 只能在ie在可以執行 f...

iframe區域性重新整理的兩種實現方法

一 iframe實現區域性重新整理方法一 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 當點a1時在iframe裡顯示a1.html的內容,點a2時在iframe裡顯示a2.html的內容 二 iframe實現區域性重新整理的方法二 1 2 3 ahref a1.h...