Netscape and style="visibility:show"

A

Ahmad Noori

I have a form and in the form, I have a drop down box. Based on what
the user selects, i want to display different input boxes. Here is my
drop down box:

<td>
<select name="reptype" onchange="checkVersion4()">
<option value=""></option>
<option value="A">A:</option>
<option value="B">B:</option>
<option value="C">C:</option>
</select> </td>
So, as soon as there is a change i call my "checkVersion4()" and in
there i want to hide a this input box that I have in my form:
<div id="div1" style="visibility:show"> <input type="text"
name="repchapter" />
</div>
and my method checkVersion4() is:
eval(document.div1.visibility = 'hidden');

I can't get this to work on Netscape I got it working on IE. Does
anyone have an idea why? Or know of a good example for Netscape or Mozilla?

Thanks
 
D

DU

Ahmad said:
I have a form and in the form, I have a drop down box. Based on what
the user selects, i want to display different input boxes. Here is my
drop down box:

<td>
<select name="reptype" onchange="checkVersion4()">
<option value=""></option>
<option value="A">A:</option>
<option value="B">B:</option>
<option value="C">C:</option>
</select> </td>
So, as soon as there is a change i call my "checkVersion4()" and in
there i want to hide a this input box that I have in my form:
<div id="div1" style="visibility:show">

It's visibility:visible or visibility:hidden. You're using the old (and
invalid) NS 4 property value (show).
http://www.w3.org/TR/CSS2/visufx.html#propdef-visibility

<input
type="text" name="repchapter" />
</div>
and my method checkVersion4() is:
eval(document.div1.visibility = 'hidden');

I recommend to never use eval; 99.9% of the times, eval() is not best.
When you try to access a document node, one of the W3C DOM 2 compliant
way is to use the getElementById method. E.g.:

document.getElementById("div1").style.visibility = 'hidden';

which will work in all W3C compliant browsers (MSIE 5+ on all platforms,
Opera 6+, Mozilla 0.9+, NS 6+, Konqueror 3+, Safari 1.x, etc...).
I can't get this to work on Netscape I got it working on IE. Does
anyone have an idea why? Or know of a good example for Netscape or
Mozilla?

Thanks

Using Web Standards in Your Web Pages
http://www.mozilla.org/docs/web-developer/upgrade_2.html

Updating DHTML Web Pages for next generation browsers
http://devedge.netscape.com/viewsource/2001/updating-dhtml-web-pages/

You should declare a doctype and then validate your markup and CSS source.

http://www.w3.org/QA/2002/04/valid-dtd-list.html

http://validator.w3.org/

W3C Quality Assurance: Quality tips for webmasters
http://www.w3.org/QA/Tips/

Web developer documentation for Mozilla
http://www.mozilla.org/docs/web-developer/

DU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top