gpt4 book ai didi

javascript - 输入类型提交错误填充

转载 作者:太空宇宙 更新时间:2023-11-03 23:35:26 24 4
gpt4 key购买 nike

这是我的代码:

<script>
String.prototype.replaceAll = function(str1, str2, ignore){
return this.replace(new RegExp(str1.replace(/([\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|<\>\-\&])/g, function(c){return "\\" + c;}), "g"+(ignore?"i":"")), str2);
};

var searchList = {
Google : "http://google.com/search?q=[Q]",
Yahoo : "https://hk.search.yahoo.com/search?p=[Q]",
DuckDuckGo : "https://duckduckgo.com/?q=[Q]",
YahooKnowledgeHK : "https://hk.knowledge.yahoo.com/search/search_result?p=[QUERY]",
Ebay : "http://search.ebay.com/[Q]"
};

function search(){

try {
searchEngine = document.querySelector("#searchEngine");
searchQuery = document.querySelector("#searchQuery");

window.location.href = searchList[searchEngine.value].replaceAll("[Q]", searchQuery.value);
}
catch (e){
alert("Error : " + e + ".");
}
}
</script>
<style>
[searchBar] {
font-family: "Courier New", Courier, monospace;
}

form[searchBar] {
margin: 0px;
}

input[searchBar], select[searchBar] {
display: inline-block;
height: 30px;
padding: 5px!important;
margin: 0px!important;
line-height: 30px!important;
border: 1px solid #000000;
}

input[type="submit"][searchBar] {
background-color: #ffffff;
transition: all 0.5s ease-in-out 0.1s;
}

input[type="submit"][searchBar]:hover { transform: rotate(360deg); }

#search-bar[searchBar] {
display: inline-block;
margin: 0px;
padding: 10px;
border: 5px groove #000000;
width: auto; height: auto;
background-color: #fff;
transition: all 0.5s ease-in-out;
}

#searchQuery[searchBar] {
width: 100px;
transition: all 0.5s ease-in-out;
}

#searchQuery[searchBar]:focus {
width: 200px;
}
</style>
<div searchBar id="search-bar">
<form searchBar id="search-form">
<select searchBar id="searchEngine">
<option disabled value="">Search Engine : </option>
<option disabled></option>
<option disabled>Most Popular</option>
<option selected value="Google">Google</option>
<option value="Yahoo">Yahoo</option>
<option value="DuckDuckGo">DuckDuckGo</option>
<option disabled></option>
<option disabled>Learn Everything!</option>
<option value="YahooKnowledgeHK">Yahoo! Knowledge HK</option>
<option disabled></option>
<option disabled>Go Shopping</option>
<option value="Ebay">Ebay</option>
</select>
<input searchBar id="searchQuery" type="text" placeholder="Search......" />
<input searchBar type="submit" onclick="search();return false;" value="Search!" />
</form>
</div>

JS Bin

提交按钮的 padding-bottom 不太合适,而 padding-top 太高了。

我能做些什么(任何东西,HTML 或 CSS)使填充与 input type="text"select 相同?

我不知道该怎么办。请帮忙^.^!

最佳答案

删除 line-height: 30px!important; 来自:

input[searchBar], select[searchBar] {
display: inline-block;
height: 30px;
padding: 5px!important;
margin: 0px!important;
line-height: 30px!important;
border: 1px solid #000000;
}

关于javascript - 输入类型提交错误填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24297850/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com