html - 如何在 wordpress.com 网站中添加按钮和输入
问题描述
我在我的 wordpress.com 网站上添加了一个自定义 html 块,并编写了一些简单的代码来充当搜索小部件。
我已经尝试了很多东西。我尝试让按钮运行脚本函数,我尝试让函数监听按钮,我尝试使用 aa href 链接(如果我更努力的话,也许会起作用)。
<input type="text" id="input" value="Search...">
<br>
<button onclick="window.location.href = 'https://vinelings.home.blog/?s=' + document.getElementById('input').value"> Search</button>
我希望它使按钮抓取输入文本,然后将选项卡重定向到该术语的搜索。不确定这是否是 wordpress.com 的问题,如果是,我可以以任何方式解决它吗?
代码:https ://imgur.com/iRvb29V.jpg 结果:https ://imgur.com/GUcwIg9.jpg
编辑:
我正在使用该Custom HTML
块。我的主题是 ALtoFocus。
解决方案
推荐阅读
- flutter - 测量颤振应用程序启动时间
- html - CSS 元素没有响应
- oracle - 如何在 sql*plus 中使用 dbms_lob.substr
- javascript - 在 Altair / Vega 中,有没有办法在点击时运行任意 Javascript 代码?
- c++ - MSVC 不允许重载 -> 运算符,它返回指向标量类型别名的指针
- vue.js - 基于路由的条件状态
- html - 如何在桌面和移动设备上使图像中的文本动态化
- c - Linux中的键盘频率
- c - 从 C 中的二进制文件读取整数数组时中止陷阱
- javascript - ParserError:预期的编译指示、导入指令或合同/接口/库定义