• Main navigation
登入區塊
帳號:

密碼:

記住我



忘記密碼?

現在註冊!
網站資訊區塊
站務管理者

kiang
 

tokimeki
 

sam0228
 

morris
 

shiang
 

SoltyRain
 

廣告





在iframe使用location.href的問題(ie及firefox)
Just popping in
註冊日期:
2006/8/8 11:33
文章: 3
a.htm
--------------------------------------
This is a.htm
<iframe src=b.htm width=200 height=200></iframe>
--------------------------------------

b.htm
--------------------------------------
This is b.htm
<script>
top.location.href('c.htm');
</script>
--------------------------------------

依上面的寫法
在IE上可以使整頁換到c.htm
但是在firefox不行
有沒有人可以幫幫忙,謝謝

發表日期:2006/8/9 11:56
應用擴展 工具箱


回覆: 在iframe使用location.href的問題(ie及firefox)
網站管理員
註冊日期:
2006/1/23 14:02
文章: 258
嘿嘿, 最近剛好處理完這個問題. 以下是我的範例, 供您參考.

1. javascript 中 frame 的使用
例:
<frameset cols="100,*">
<frame src="a.asp">
<frame src="b.asp">
</frameset>

如果要變更第一個 frame 的 location:
parent.frames[0].location

2. javascript 中 getYear() 的使用
例:日期如果為 2006/1/12,
在IE使用 getYear(), 會取得 2006;
在FireFox使用 getYear(), 會取得106.

兩全的方法是: getFullYear().

發表日期:2006/8/9 14:46
_________________
『當是非對錯不能用黑白劃分,標準答案與事實真相早就沒有了意義』
應用擴展 工具箱


回覆: 在iframe使用location.href的問題(ie及firefox)
Just popping in
註冊日期:
2006/8/8 11:33
文章: 3
frame好像可以
但是怎麼試都還是不行讓iframe的上一層換頁

發表日期:2006/8/10 6:49
應用擴展 工具箱


回覆: 在iframe使用location.href的問題(ie及firefox)
Home away from home
註冊日期:
2006/5/16 21:27
文章: 171
引用:
b.htm
--------------------------------------
This is b.htm
<script>
top.location.href('c.htm');
</script>
--------------------------------------

請注意 href 不是一個 location 的 function,它是 location 的 property,正確的用法是:

top.location.href="c.htm";

估計你看的是 Micro$oft 的書吧,那些書真是誤人子弟

發表日期:2006/8/10 11:24
_________________
Open in new window
香港 PHP 用家社區
應用擴展 工具箱


回覆: 在iframe使用location.href的問題(ie及firefox)
Just popping in
註冊日期:
2006/8/8 11:33
文章: 3
哈~一語點醒夢中人
^^謝謝各位前輩的指導
OK了

發表日期:2006/8/10 14:56
應用擴展 工具箱







[進階搜尋]