禁用HTML中的文本字段 [英] Disable text field in html

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

问题描述

有人可以帮助我吗?

如果用户输入与我在函数中设置的单词相同,则我已经在html中创建了一个用于禁用文本字段的函数.然后,如果所有文本字段均被禁用,则将出现提示.

我的问题:如何检查我的所有文本字段是否都已禁用?

有人知道该怎么办吗?我需要在代码中添加什么?

Anyone can help me?

I had create a function in html for disable text field if the user input is same with word I set in the function. Then if all the text field are disable, so the prompt will appear.

My question : how I want to check whether all my text field had disable?

Anyone know what to do? What I need to add in the code?

<script language="JavaScript">
   
    function setText(){
	
      if(document.check.huruf4.value == "ا")
	  {
		document.check.huruf4.disabled = true;  
	  }
	  if(document.check.huruf3.value == "ل")
	  {
		document.check.huruf3.disabled = true;  
	  }
	  if(document.check.huruf2.value == "و")
	  {
		document.check.huruf2.disabled = true;  
	  }
	  if(document.check.huruf1.value == "ب")
	  {
		document.check.huruf1.disabled = true;  
	  }
	 } 

推荐答案

在条目的末尾,当您需要了解是否所有字段都被禁用时,请调用Javascipr方法.
在此方法中,检查所有4个文本框的禁用状态.如果发现任何未禁用的设备,请发送一个错误的标志作为返回.如果您全部禁用,请在此处显示/执行操作.

试试吧!
At the end of the entry, when you need to know if all the fields are disable or not, call a Javascipr method.
In this methid, check for all your 4 textbox disable status. If you find any one not disabled send a false flag as return. If you have all disabled, show/do your stuff there.

Try!


这篇关于禁用HTML中的文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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