diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss
index d527132d..99489ed8 100644
--- a/collects/scribble/html-render.ss
+++ b/collects/scribble/html-render.ss
@@ -189,7 +189,7 @@
)
-(define search-box ; appears on every page
+(define (make-search-box top-path) ; appears on every page
(let ([sa string-append]
[emptylabel "...search manuals..."]
[dimcolor "#888"])
@@ -201,7 +201,8 @@
[type "text"]
[value ,emptylabel]
[title "Enter a search string to search the manuals"]
- [onkeypress ,(format "return DoSearchKey(event, this, ~s);" (version))]
+ [onkeypress ,(format "return DoSearchKey(event, this, ~s, ~s);"
+ (version) top-path)]
[onfocus ,(sa "this.style.color=\"black\"; "
"this.style.textAlign=\"left\"; "
"if (this.value == \""emptylabel"\") this.value=\"\";")]
@@ -209,6 +210,8 @@
" this.style.color=\""dimcolor"\";"
" this.style.textAlign=\"center\";"
" this.value=\""emptylabel"\"; }")]))))
+(define search-box (make-search-box "../"))
+(define top-search-box (make-search-box ""))
;; ----------------------------------------
;; main mixin
@@ -643,7 +646,7 @@
`[onclick . ,(format "return GotoPLTRoot(\"~a\");" (version))]))
(define navleft
`(span ([class "navleft"])
- ,search-box
+ ,(if up-path search-box top-search-box)
,@(render
sep-element
(and up-path (make-element top-link top-content))
diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js
index 91250e4c..89b35492 100644
--- a/collects/scribble/scribble-common.js
+++ b/collects/scribble/scribble-common.js
@@ -44,11 +44,11 @@ function NormalizePath(path) {
return path;
}
-function DoSearchKey(event, field, ver) {
+function DoSearchKey(event, field, ver, top_path) {
var val = field.value;
if (event && event.keyCode == 13) {
var u = GetCookie("PLT_Root."+ver, null);
- if (u == null) u = "../"; // default: go up
+ if (u == null) u = top_path; // default: go to the top path
location = u + "search/index.html" + "?q=" + escape(val);
return false;
}