# 能否将搜索表单放在我们404页面的顶部？

**URL:** <https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406>\
**Category:** Product Support\
**Created:** [2021 年11 月 29 日 14:30 UTC](https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406 "2021-11-29T14:30:45Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

作者： ![hhlp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hhlp/32/124988_2.png) [@hhlp](https://meta.discourse.org/u/hhlp)\
发布日期： [2021 年12 月 2 日 11:49 UTC](https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406/7 "2021-12-02T11:49:29Z")

</div>

是的，404 页面未找到中没有插件插槽，按照您的指示完美运行

将此粘贴到 BODY 标签中：

```javascript
    var x = document.getElementsByClassName("page-not-found"); 
    var search = '<h2>Search this site</h2><p></p><form action="/search" id="discourse-search"><input type="text" name="q" value=""><button class="btn btn-primary">Search</button></form><p></p>'
    x.item(0).innerHTML += search

```

并将这些粘贴到 CSS 部分：

```plaintext
.page-not-found-search {
    display: none;
}

.page-not-found-search-top button {
    margin-left: 10px;
}

.page-not-found-search-top input {
    width: 600px;
}

```

在移动设备上也能正常工作……

感谢您的回复

此致，

---

_[View the full topic](https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406)._
