There is a search input box in the header, the Search button is a button control, and the button control is also used in the news article search user Custom control.
stops the focus in the information title or content input box, and returns, but the input box in the header corresponds to the contents.
Reason: Enter execution is the first submit button on your page. Workaround: (for example, the information search input box below)
1, JS:
----------------------------------------------------------------------------
/* Enter after the button to perform * *
function Submitkeyclick (button) {
if (Event.keycode = = 13) {
Event.keycode = 9;
Event.returnvalue = false;
Document.all[button].click ();
}
}
function Checkinputbox () {
var charbag = "[^ ' ~@#$%^&/' |*]";
var searchkey = document.getElementById ("Articlesearch1_txtsearchkey");
if (Trim (searchkey.value). Length = = 0 | | Trim (searchkey.value). Length > 30) {
alert ("The news article keyword cannot all be empty or cannot be longer than characters!") ");
Searchkey.focus ();
return false;
}
if (Trim (searchkey.value)!= "") {
for (var i = 0; i < searchkey.value.length i++) {
var c = searchkey.value.charAt (i);
if (Charbag.indexof (c) >-1) {
alert ("The search news article keyword string contains illegal characters (" + C + ")! ");
Searchkey.focus ();
return false;
}
}
}
}
2, aspx page control:
---------------------------------------------------
<input id= "Txtsearchkey" name= "Txtsearchkey" type= "text" runat= "server" maxlength= "onfocus=" This.select () ; "/>
3, CS:
---------------------------------------------------
this.txtSearchKey.Attributes.Add ("onkeyPRess", "Submitkeyclick (' Articlesearch1_btnsearch ');");
this.btnSearch.Attributes.Add ("onclick", "return Checkinputbox ();");
is in the header's CS and adds the attributes attribute of the input box.
this.txtKey.Attributes.Add ("onkeypress", "Submitkeyclick (' Header1_btnsearchkey ');");