Home > Web Front-end > JS Tutorial > javascript clears the value of a certain element in the form_form special effects

javascript clears the value of a certain element in the form_form special effects

WBOY
Release: 2016-05-16 18:38:11
Original
1393 people have browsed it

Let’s take the case type="text" as an example:

Copy the code The code is as follows:







By calling the Refresh method of js
Method 1
Copy code The code is as follows:

function Refresh()
{
var v=document .forms[0].elements;
for(var i=0;i{
if(v[i].type=="text")
{
v[i].value="";
}
}

}

or method two
Copy code The code is as follows:

function Refresh()
{
var v=document.getElementsByTagName("input" );
for(var i=0;i{
if(v[i].type=="text")
{
v[ i].value="";
}
}
}

Clear the value of an element by calling the refresh function
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