<html> Testing JavaScript DJS Functions <br> <script> menu.addItem(new NavBarMenuItem ("All Available Information","javaScript:top.location= \qgateway-URL/http://abc.sesta.com\q"));
// abc.sesta.com 是閘道服務的 [網域與子網域的代理伺服器] 清單中的一項。因此 Rewriter 需要重新寫入此 URL。但因為是絕對 URL,因此不需前置 Portal Server URL。DJS 規則指出 DJS 函數 NavBarMenuItem 的第二個參數需重新寫入。但是第二個參數又是 JavaScript 變數。重新寫入此變數的值需要第二個規則。第二個規則指出 JavaScript 變數 top.location 的值需重新寫入。由於符合所有條件,因此重新寫入 URL。
//menu.addItem(new NavBarMenuItem("All Available Information","http://abc.sesta.com"));
// 雖然 DJS 規則指出函數 NavBarMenuItem 的第二個參數需要重新寫入,但此陳述式中並未進行重新寫入。這是因為 Rewriter 未將第二個參數識別為簡單 HTML。
</script> </html>