在ASP.NET中清除文本框历史记录 [英] Clear textbox history in ASP.NET

查看:589
本文介绍了在ASP.NET中清除文本框历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何清除文本框的历史记录?我已经设置了autocomplet = off并将AutoCompleteType设置为Disabled。当我在Chrome / Firefox中双击文本框时会出现历史/文本,所以当我点击它时,文本将被插入到文本框中。有没有办法通过ASP.NET / HTML停止这种行为?

解决方案

如果它不适用于自动完成关闭,在每次将页面加载到浏览器时,尝试>将文本框/输入名称(不是Id)更改为随机值。



您可以在窗口加载时使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆