Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden/Visible Style in I.E 1

Status
Not open for further replies.

iaresean

Programmer
Mar 24, 2003
570
ZA
Hey all,

In M.I.E I can make a object disappear using the following javascript code: ...style.visibility = "hidden";

but using this code to make it reappear does not work: ...style.visibility = "visible";

Idea why it works in NN and Mozilla but not I.E?

Thanks in advance!

Sean.
 
works fine for me in IE and Moz

<div id=&quot;foo&quot;>foo</div>
<input type=&quot;button&quot; value=&quot;hide&quot; onclick=&quot;document.getElementById('foo').style.visibility = 'hidden';&quot; />
<input type=&quot;button&quot; value=&quot;show&quot; onclick=&quot;document.getElementById('foo').style.visibility = 'visible';&quot; />




=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
I seem to have found the problem.

In the following code:
Code:
[COLOR=green]
        function selectChange(formname) {
                var selectboxid=(&quot;rectype&quot;+formname);
                var mxvalueid=(&quot;mxvalue&quot;+formname);
                
                var selectedval = window.document.getElementById(selectboxid).value;
                
                alert(&quot;selectboxid is &quot; + selectboxid + &quot; mxvalueid is &quot; + mxvalueid + &quot; selectedval = &quot; + selectedval);
                if (selectedval == &quot;MX&quot;) {
                        window.document.getElementById(mxvalueid).style.visibility = 'visible';
                }
                else{
                        window.document.getElementById(mxvalueid).style.visibility = 'hidden';
                }
        }
[/color]

The selectedval variable has no value in I.E, but has one in Moz. This means that my if else statement always goes to the else part meaning, invisible only.

Is there a different method to getting the selected value in a select box in I.E.?

Thanks in advance.

Sean.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top