I do not want to have a submit button as I want people to be able to enter the form field and then to search all they have to do is press the enter button.
我不希望有一个提交按钮,因为我希望人们能够进入表单字段,然后搜索所有他们要做的就是按下回车键。
Here is my code:
这是我的代码:
HTML
HTML
<div class="search">
<div class="search1" form action="weezyresults.php" method="post">
<input type="text" name="search" size="30" value=""
style="background-color:white; border:
solid 1px #ffffff; height: 30px; font-size:19px;
font-family: HelveticaNeue-Light; font-weight: 1;
vertical-align:9px;color:#151515"
onfocus="if(this.value == ''){this.value =
'';this.style.color='#363D42'}" />
</div>
<div class="enter"><input type="image" src="but.jpg" alt="Submit"></div>
CSS
CSS
.search {
background: #FFFFFF;
border: 1px solid;
color: #BDBDBD;
height: 35px;
width: 270px;
}
.search1 {
margin-top: 3px;
float: left;
}
.enter {
display:none;
}
Thanks!
谢谢!
James
詹姆士
4 个解决方案
#1
4
<div class="search1" form action="weezyresults.php" method="post">
Should be
应该
<div class="search1">
<form action="weezyresults.php" method="post">
#2
1
Include the submit button, but style it with:
包括提交按钮,但将其设置为:
display:none;
You also have an error in your syntax:
您的语法也有错误:
<div class="search1" form action="weezyresults.php" method="post">
needs to be
需要是
<div class="search1"> <form action="weezyresults.php" method="post">
Good luck !
祝你好运 !
#3
0
write js function and say which will post the form. pseudo code would be
写js函数并说出哪个会发布表单。伪代码会
funciton post()
{
if(keycode==13)
__dopostback();
}
And if you using jquery then, you can use
如果您使用jquery,那么您可以使用
jquery("form selector").post()
#4
-2
Then you should do like this.
那你应该这样做。
function formSubmit(element, ev) {
//element is the this selector for current element and ev is the event-trigger to get keycode
if (ev.keyCode === 13) { // 13 is the keycode for Enter-button
element.form.submit(); //Then submit the button
}
}
And add this onkeypress="submiter(this,event)"
to your input field.
并将此onkeypress =“submiter(this,event)”添加到您的输入字段。
#1
4
<div class="search1" form action="weezyresults.php" method="post">
Should be
应该
<div class="search1">
<form action="weezyresults.php" method="post">
#2
1
Include the submit button, but style it with:
包括提交按钮,但将其设置为:
display:none;
You also have an error in your syntax:
您的语法也有错误:
<div class="search1" form action="weezyresults.php" method="post">
needs to be
需要是
<div class="search1"> <form action="weezyresults.php" method="post">
Good luck !
祝你好运 !
#3
0
write js function and say which will post the form. pseudo code would be
写js函数并说出哪个会发布表单。伪代码会
funciton post()
{
if(keycode==13)
__dopostback();
}
And if you using jquery then, you can use
如果您使用jquery,那么您可以使用
jquery("form selector").post()
#4
-2
Then you should do like this.
那你应该这样做。
function formSubmit(element, ev) {
//element is the this selector for current element and ev is the event-trigger to get keycode
if (ev.keyCode === 13) { // 13 is the keycode for Enter-button
element.form.submit(); //Then submit the button
}
}
And add this onkeypress="submiter(this,event)"
to your input field.
并将此onkeypress =“submiter(this,event)”添加到您的输入字段。