使用javascript设置禁用的文本框值 [英] Set disabled text box value using javascript

查看:159
本文介绍了使用javascript设置禁用的文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

**你好伙计,**



我有一个普通的asp.net文本框,其中'Enabled = false;`属性。



当我尝试使用java脚本设置其值时,它实际上工作得很好



但如果页面回发它会失去其价值。



我怎样才能让它保持其价值?



任何想法?

**Hello Guys,**

I have a normal asp.net Text Box with `Enabled = false;` Property.

when i try to set its value using java Script it works fine actually

But if the page posted back it looses its value.

how can i make it keeps its value?

Any Ideas?

推荐答案

这是一篇文章 [ ^ 有一个好主意。
Here is an article[^] that has a good idea.


我认为你不想使用Enabled as false。启用属性的目的是让它可用或不可用。



如果您启用了false,为什么要滥用该属性只是因为你可以做它带有某种客户端脚本。



如果你想阻止用户访问文本框,我建议使用ReadOnly属性。



或者您也可以借助Css使其看起来像残疾/只读。
I don't think you want to use Enabled as false. The purpose of enabled property is to have it available or not.

And if you have enabled as false, why do you want to abuse the property just because you can do it with some sort of client side script.

I would suggest to used ReadOnly property if you want to block the access of textbox by user.

Or you can also take help of Css to make it look like disabled/readonly.


这篇关于使用javascript设置禁用的文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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