0

I am really confused. I want to make a <p> tag hidden using javascript, and then, if i detect its running IE, i want to make it visible. I can't even make it hidden though. I have tried

<script type="text/javascript>
document.warning.style[visibility] = 'hidden';

i've tried

<script type="text/javascript>
document.warning.style.visibility = 'hidden';

and i've tried both of these variations with the getElementById('warning') instead of plain old document.warning too. Nothing works. I've even tried setting display to none. What is going on?

4
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by Bubbleboy
0

I am really confused. I want to make a <p> tag hidden using javascript, and then, if i detect its running IE, i want to make it visible. I can't even make it hidden though. I have tried

<script type="text/javascript>
document.warning.style[visibility] = 'hidden';

i've tried

<script type="text/javascript>
document.warning.style.visibility = 'hidden';

and i've tried both of these variations with the getElementById('warning') instead of plain old document.warning too. Nothing works. I've even tried setting display to none. What is going on?

try document.warning.style.display = "none";

0

Try

elementWhatever.style.display = "none";

and

elementWhatever.style.display = "block";

to hide and show the element you are trying to modify.

0

I tried cmliu2004 said, and i got a warning with the words, undefined in it.

0

I changed it to a <div> tag surrounding the <p> tag and gave it the ID of warning. Then tried it with alert(document.getElementById('warning')) and it didn't give an alert at all.

0

Alright, i give up on the styles thing. So i have switched to using an if(isIE) thing that then gives an alert('you are using internet explorer...') thank you for the help anyway!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.