[英]How can I set the cursor position in a WebControl textbox in ASP.NET?
I need to set the cursor to the end of a webcontrol textbox. 我需要将光标设置在WebControl文本框的末尾。 How can I do that?
我怎样才能做到这一点?
You can do that only with JavaScript.on page load event. 您只能使用JavaScript.on页面加载事件来做到这一点。 Just add this code into your section by provideing id of your textbox
只要提供您的文本框ID,即可将此代码添加到您的部分中
<script type="text/javascript">
window.onload = function() {
var oInput = document.getElementById("<%=TextBox1.ClientID%>");
oInput.focus();
oInput.value += "";
};
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.