Created
January 4, 2012 15:26
-
-
Save anonymous/1560533 to your computer and use it in GitHub Desktop.
CSS Style - Should set to empty string, not inherit. Just an example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type="text/css"> | |
.test1 { | |
display: inline; | |
border: 2px solid green; | |
background-color: tan; | |
} | |
.test2 { | |
display: block; | |
border: 2px solid red; | |
background-color: navy; | |
} | |
</style> | |
<script type="text/javascript"> | |
var b = 0; | |
var a = 0; | |
function reset(){ | |
a=0; | |
b=0; | |
document.getElementById('hi').style.display=""; | |
} | |
function usingBlank(){ | |
var x = document.getElementById('hi'); | |
if (a === 0) { | |
x.style.display = "none"; | |
a = 1; | |
} else { | |
x.style.display = ""; | |
a = 0; | |
} | |
} | |
function usingInherit(){ | |
var x = document.getElementById('hi'); | |
if(b===0){ | |
x.style.display="none"; | |
b=1; | |
} else { | |
x.style.display="inherit"; | |
b= 0; | |
} | |
} | |
</script> | |
</head> | |
<div class="test1"> | |
<div class="test2" id="hi"> | |
Hello | |
</div> | |
</div> | |
<button onclick="usingInherit()">Click For Inherit</button> | |
<button onclick="usingBlank()">Click For Empty String</button> | |
<button onclick="reset()">Click To Reset</button> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment