你需要
nothing to change
用于服务器控制
except the syntax
就这个例子而言。
<asp:TextBox id="txt1" runat="server" value="Selected?"><asp:TextBox>
<asp:Button id="btnSubmit" runat="server" OnClientClick="alert(isTextSelected();" ></asp:Button>
function isTextSelected() {
input = document.getElementById('<%= test.ClientID %>'))
if (typeof input.selectionStart == "number") {
return input.selectionStart == 0 && input.selectionEnd == input.value.length;
} else if (typeof document.selection != "undefined") {
input.focus();
return document.selection.createRange().text == input.value;
}
}