根据FileUpload的值,控制textBox的可用与否
2024-08-23 00:35:35
JS代码:
<script type="text/javascript">
$(document).ready(function ()
{
$("#<%= masterFileUpload.ClientID %>").change(function ()
{
if ($("#<%= masterFileUpload.ClientID %>").val() != "")
{
$("#<%=txtMasterFilePwd.ClientID%>").removeAttr("disabled", "disabled");
}
else
{
$("#<%=txtMasterFilePwd.ClientID%>").val("");
$("#<%=txtMasterFilePwd.ClientID%>").attr("disabled", "disabled");
}
}); });
</script>
HTML代码:
<tr>
<td style="text-align: right" class="auto-style1">**文件名:</td>
<td class="auto-style2">
<asp:FileUpload ID="masterFileUpload" runat="server" ClientIDMode="Static" Width="350" />
</td>
<td class="auto-style2">
<asp:Label ID="lbmasterFileUpload" runat="server" ClientIDMode="Static"></asp:Label>
</td>
</tr>
<tr>
<td style="text-align: right" class="auto-style1">**密码:</td>
<td class="auto-style2">
<asp:TextBox ID="txtMasterFilePwd" runat="server" CssClass="txt_search" ClientIDMode="Static" Width="200px" onkeydown="if(event.keyCode==222){return false;}" ></asp:TextBox>
</td>
</tr>
说明: <asp:TextBox ID="txtMasterFilePwd"。。。。>是服务器控件,但是在JS中设置它的属性时,一定要用编译后生成的对应HTML控件的属性才好用。
最新文章
- from collections import OrderedDict
- 孙鑫MFC学习笔记2:C++回顾
- js控制精度的加减乘除:js浮点数计算问题
- c/c++细节知识整理
- SQLServer找出执行慢的SQL语句
- mysql查找字符串出现位置
- ruby(html)
- 【转】Linux中安装Resin
- css两列布局,一边固定宽度,另一边自适应
- Linq技术四:动态Linq技术 -- Linq.Expressions
- wenpack-simple+elementUI配置
- oracle数据库--序列(sequence)
- Bootstrap3 表格-带边框的表格
- vuex 收藏一个循序渐进,易懂易行的博客。
- mysql 开发基础系列2 整型数据类型
- 用例该如何书写?完整示例-QQ登录界面
- Android四大组件之---activity生命周期详解
- PDCA 价值所在
- Spring Boot 连接池
- 使用SplashScreenManager控件定制程序加载页面
热门文章
- net start sql server (instance)
- Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Cannot open connection
- Eclipse中插件的使用:maven /ant /tomcat
- Entity Framework Code-First(9.4):DataAnnotations - Required Attribute
- SCSS 中的 &;::before 和 &;::after
- Page_Load事件与IsPostBack属性
- BKMyFAQ
- elasticsearch shard 和 replica
- 水库(树形dp)
- bzoj 4974: [Lydsy八月月赛]字符串大师