在ASP.NET中清除文本框历史记录 [英] Clear textbox history in ASP.NET
问题描述
我如何清除文本框的历史记录?我已经设置了autocomplet = off并将AutoCompleteType设置为Disabled。当我在Chrome / Firefox中双击文本框时会出现历史/文本,所以当我点击它时,文本将被插入到文本框中。有没有办法通过ASP.NET / HTML停止这种行为?
解决方案如果它不适用于自动完成关闭,在每次将页面加载到浏览器时,尝试
您可以在窗口加载时使用javascript来做到这一点:
window.onload = function(){
document.getElementById(yourTextboxId)。name =txt+ Math.random();
}
how can I clear the history of a textbox? I have set autocomplet=off and set AutoCompleteType to Disabled. The history / text appears when I double click the textbox in Chrome / Firefox, so when I click it the text will be inserted in the textbox. Is there a way to stop this behaviour via ASP.NET / HTML?
If it doesn't work with autocomplete off, try to change the textbox/input name (not the Id) to a random value
every time you load the page to the browser.
You can do it using javascript on window load as below:
window.onload = function () {
document.getElementById("yourTextboxId").name = "txt"+ Math.random();
}
这篇关于在ASP.NET中清除文本框历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!