2012-03-21 78 views
0

我想堅持窗口位置。但是,Windows ID是動態的。動態ID持續窗口屏幕

下面是詳細情況.. dynamic_id將是"id1", "id2" ... "id5"一個//這些固定 window.openDialog("chrome://something/content/test.xul, name, dynamic_id)

和我test.xul

<window persist="screenX screenY" ..... >/<window>

現在我怎麼能實現窗口的持久性。

我嘗試添加 window.id = dynamic_id,但它不工作..

或者,如果有一種方法可以做類似如下: <window id = "dynamic_id" persist= ..../></window>

在此先感謝!

回答

0

這是因爲url始終是相同的,這是mozilla用來記住「持久化事物」數據庫中「持久化事物」的「id」。

這樣做:

openDialog("chrome://something/content/test.xul?id=" + dinamic_id, name) 

然後在text.xul,你要獲得ID,這樣做:

id = location.search.match(/id=([^&]+)/) && RegExp.$1