1.html js button 按钮怎么写事件代码
<!DOCTYPE html>
<html lang="en" charset='utf-8'>
<style>
.d3 form {
background: #E5E5E5;
position: relative;
margin: 0 auto;
}
.d3 input, .d3 button {
border: none;
outline: none;
background: transparent;
}
.d3 input {
width: 100%;
height:35px;
padding-left: 15px;
font-size:13px;
font-family:微软雅黑;
}
.d3 button {
height: 35px;
width: 35px;
position: absolute;
top: 0;
right: 0;
cursor: pointer;
}
.d3 button:before {
font-size: 13px;
}
</style>
<div class="d3">
<form>
<input type="text" id='serchbox' placeholder="发帖求助前要善用【搜索】功能,这里可能会有你要找的答案。">
<button id="search-btn" onclick="serch();" type="submit"/><img src="so.png" height="19" width="18" alt="搜索" /></button>
</form>
</div>
<script>
function serch(){
var value = document.getElementById('serchbox').value;
window.open('a/'+value);
}
</script>
</body>
</html>