js switch text box read-only and writable dynamic switching

2010-03-21  来源:本站原创  分类:Java  人气:300 

Sometimes pages need to temporarily switch the text box read-only or writable, and sometimes we can use simple control can be disabled, but disabled the controls after controlling for the value can not be transmitted to the server, in the realization of the function on the whole a little trouble. Is therefore how to set up a text box read-only and writable problems
The following is a complete test case, pay attention: "readOnly" must be case-sensitive

<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.0 Transitional / / EN">
<HTML>
<HEAD>
<TITLE> Page text boxes read-only or writable temporary switch </ TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</ HEAD>
<BODY>
<input type="text">
<input type="button" value="writer">
<input type="button" value="readonly">
<script type="text/javascript">
function a () (
document.getElementById ( "aa"). removeAttribute ( "readOnly");
)
function b () (
document.getElementById ( "aa"). setAttribute ( "readOnly", "true");
)
</ script>
</ BODY>
</ HTML>

相关文章
  • js switch text box read-only and writable dynamic switching 2010-03-21

    Sometimes pages need to temporarily switch the text box read-only or writable, and sometimes we can use simple control can be disabled, but disabled the controls after controlling for the value can not be transmitted to the server, in the realization

  • js filter text box characters 2010-10-18

    js regular expressions to limit the text box can only enter numbers, decimal points, letters, characters and other kinds of code [Align = center] [/ align] 1. Text box can only enter the numeric code (decimal point can not be input) <input onkeyup=&quo

  • JavaScript html js input text box only figure 2009-05-18

    <input name="selectID" type="text" size="30" onkeydown="if(event.keyCode==13)event.keyCode=9" onKeyPress="if ((event.keyCode <48 || event.keyCode>57)) event.returnValue=false"> Black hair: http

  • js can input text box control 2010-09-10

    <! DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Transitional / / EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns = " http://www.w3.org/1999/xhtml "> <head> <meta http-equi

  • Select All check box implementation JS / switch will not run the whole 2009-05-22

    Select All check box implementation JS / switch will not run the whole from: http://shaobo.javaeye.com/ <input type=checkbox name=mm value=a> <br> <input type=checkbox name=mm value=b> <br> <input type=checkbox name=mm value=c&g

  • Click the text box displays the time the drop-down list Data.js 2009-09-09

    1, the introduction of Date.js documents: <script language="javascript" src="images/Date.js"> </ script> 2, in the input text box of time to write on the onfocus (setday (this)) events <td> <input type="text&q

  • js regular expressions to limit the text box can only enter numbers, decimal points, letters, characters and other kinds of code 2010-12-28

    1. User name only in English, Chinese characters of mixed numbers and var reg = / ^ (\ w | [\ u4E00-\ u9FA5 ])*$/; if (arr = username.match (reg)) { ti = 1; return ture; } else { alert ("User name only in English, numbers, and characters of the hybri

  • js regular expressions to limit the text box can only enter numbers, decimal points, letters (to) utility 2010-10-21

    1. Text box can only enter the numeric code (decimal point can not be input) <input onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> 2. Can only enter a number, can input a

  • EXT join in the text box icon 2010-03-17

    EXT join in the text box icon. Define css: Js code. Login (background-image: url (/ ExtDwrJson / images / login_user.gif)! Important; background-repeat: no-repeat; background-position: right;). Password (background-image: url ( / ExtDwrJson / images

  • Front text box data and import and export EXCEL 2010-03-31

    Main points to achieve two functions: (text box on a piece of the picture simply are no rules, but in the same column or peers, the size of different lengths) 1. The reception of all designated areas to export into a text box the value of the EXCEL t

  • Text box background section shows 2010-05-03

    Text box background sub-display function was not used in a lot of web development. I've seen only in some online banks enter the bank card number, when there was an effect. Enter 4-digit figures, followed by 4 digits into the background of gray, then

  • Drop-down list box, text box control button labels simple example of the use of calculator 2010-05-07

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="caculate.aspx.cs" Inherits="caculate" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DT

  • jquery mouse wheel to control the number of changes in the text box 2010-06-26

    View results Download jquery mouse wheel to control the number of changes in the text box jquery mouse wheel to control the number of changes in the text box, do not know how to describe to you, that is, the page text box, as long as the mouse moves

  • js Search drop-down box select and select the top option example of a moving target 2010-09-11

    Sometimes, too much of a drop-down box element is not convenient choice. May you also have common feelings, and lift it out is not found to pull down the options. Now to achieve a result: js Search drop-down box to select and select the target option

  • JS Effects Code Complete (4) js pop-up dialog box 2010-09-19

    js pop-up dialog box in some cases is a very good tool, through the translucent setting, makes the pop-up dialog box pop up when js is still able to see the page content. This js pop-up dialog box will not allow visitors to get lost, or transfer them

  • Text box just can check the best way to cattle 2011-05-21

    onkeypress = "return event.keyCode> = 48 & & event.keyCode <= 57" onpaste = "return! clipboardData.getData ('text'). match (/ \ D /)" ondragenter = "return false" onkeypress = "return event.keyCode> = 48

  • wap text box flush solution 2010-03-29

    As the cell phone browser cache problems, we will find that changes in recording sites in the WAP is still time to enter information on a record, that is cached information, for example, modify the information, modify personal information. I found a

  • Javascript control the text box can only import figures 2008-05-21

    Javascript control the text box can only import figures <input onkeypress="return event.keyCode>=48&&event.keyCode<=57||event.keyCode==46" onpaste="return !clipboardData.getData('text').match(/\D/)" ondragenter="r

  • javascript input text box to limit the type of 2009-02-07

    javascript input text box to limit the type of The regular, we used to write some code to the function, Now I come to you as a reference: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"&

  • Java Swing text box to enter the Chinese pop-up input window solution 2009-07-02

    java Swing inside the text box will pop up when you enter an "input window", the window people look unhappy, and there are a few bug: 1. In some versions of the jvm, there is a lot of layers of the modal dialog box when the top is using a modal