Home > Web Front-end > HTML Tutorial > Disabled button cannot pass value_html/css_WEB-ITnose

Disabled button cannot pass value_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:57:20
Original
1561 people have browsed it

The radio button made with disabled cannot pass the value. What else can achieve the same invalidation effect and can also pass the value?


Reply to the discussion (solution)

Set it to readOnly="readOnly"

Oppa, I want to make it happen The radio button is invalid. It can still be selected if it is set to readOnly.

Use an to save the value.
The displayed control is only displayed but has changed its state. It needs to be synchronized. input

I mean a readonly-like effect
example

<script>function disRadio(){rss = document.getElementsByName("r")for(i=0;i<rss.length;i++){if(!rss[i].checked)rss[i].disabled=true;}}function enableRadio(){rs = document.getElementsByName("r")for(i=0;i<rs.length;i++){rss[i].disabled=false;}}</script><form method="get"><input name=r type=radio value=1> <input name=r type=radio value=2> <input type=button value="禁用" onclick="disRadio()"><input type=button value="启用" onclick="enableRadio()"> <input type=submit value="提交"></form>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template