BubikolRamios
11-22-2012, 10:15 AM
I would expect that alert would pop up 'none'.
How to solve that ?
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.myclass
{
display:none;
}
</style>
<script>
function demoDisplay()
{
alert(document.getElementById("p1").style.display);
}
</script>
</head>
<body>
<p id="p1" class = 'myclass'>This is some text.</p>
<input type="button" onclick="demoDisplay()" value="see if js can get me style from css">
</body>
</html>
How to solve that ?
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.myclass
{
display:none;
}
</style>
<script>
function demoDisplay()
{
alert(document.getElementById("p1").style.display);
}
</script>
</head>
<body>
<p id="p1" class = 'myclass'>This is some text.</p>
<input type="button" onclick="demoDisplay()" value="see if js can get me style from css">
</body>
</html>