Home > Web Front-end > JS Tutorial > body text

JS How to change the hidden attribute of span tag_javascript skills

WBOY
Release: 2016-05-16 18:01:17
Original
1611 people have browsed it

Test:
test.html
Code:

Copy code The code is as follows:




New Document







Query type

Course Assignment
< select id="isAll" name="isAll">










js/Menu.js
Code:

Copy code The code is as follows:
//This is using the custom method hideElement() and shwoElement()
function isChang(values)
{
if(values=="yxsh"){
hideElement("key");
showElement("yxsh");
}else{
hideElement("yxsh");
showElement("key");
}
}
//Custom method hideElement()
function hideElement( id){
document.getElementById(id).style.display="none";
}
//Custom method showElement()
function showElement(id){
document. getElementById(id).style.display="";
}
//This is to directly set whether to hide or not without a custom function
function isChang1(values)
{
if(values= ="yxsh"){
document.getElementById("yxsh").style.display="";
document.getElementById("key").style.display="none";
}else {
document.getElementById("yxsh").style.display="none";
document.getElementById("key").style.display="";
}
}

Test results:
The default selection is: by department
This is if we choose: not by department, that is, by: employee number or name, then,
It will be hidden at this time:

and. ..
If we choose: by department, that is, by default
Then the result is:
.. .
and
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