Home > Web Front-end > JS Tutorial > A simple way to switch functions in Js_javascript skills

A simple way to switch functions in Js_javascript skills

WBOY
Release: 2016-05-16 18:15:35
Original
1362 people have browsed it

I estimate that many friends who are learning CSS and JS have also had this experience. When I was doing this JS switch, I thought of a good method and will share it with you immediately. I hope you can take it away

Copy code The code is as follows:

function changeDiv(index)
{
for(var i =0;i<=5;i )
{
if(i == index)
document.getElementById('dv_' i).className="txt1";
else
document.getElementById('dv_' i).className="txt2";
}
}

But you may not be able to see it clearly, so let me put the html It’s posted, let’s take a look,
Copy the code The code is as follows:

< table width="100%" height="616" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#FEFDF8" class="border1">
< tr>
Member registration











< ;td align="right">Password:
























< /tr>
Member name:
5-20 characters (including lowercase letters, numbers, underlines, Chinese)
Please use a combination of English letters plus numbers or symbols
Confirm password: < div id="dv_2" class="txt2">Please re-enter your password
Email:
Please enter your usual email address
QQ/Phone:
Please fill in your QQ /Phone number
Verification code: < ;div id="showErro" runat=server>
Please enter the verification code

I have read and agree to the membership terms



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