473,609 Members | 1,851 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you REALLY toggle visibility in Netscape (using 7.1 right now)

Hi,

I've read through quite a number of postings on here so far and have
seen what look like very simply, reasonable answers to this question,
however I am still completely unable to do what I want to do.

I just want to know how I should toggle the visibility of divs in
Netscape (I'm using 7). For example, say I have the following HTML
code:
<a href='javascrip t:showMyDiv();' >Show mydiv</a>

<div id='mydiv' style='visibili ty:hidden;'>
This text does not appear when I load the page in Netscape, so I know
it recognizes the 'visibility:hid den;' part of the above tag.
</div>

However, when I click on the link (coded as above), the following
javascripts do not make the div appear. It works fine in Explorer.
<script>
function showMyDiv()
{
mydiv.style.vis ibility = "visible"; // Works in IE, not Netscape
document.mydiv. style.visibilit y = "visible"; // Ditto

// THE FOLLOWING WERE SUGGESTED, BUT NONE OF THEM WORK FOR ME
document.mydiv. style.visibilit y = "show";
document.mydiv. visibility = "show";
document.mydiv. style.visibilit y = "visible";
document.mydiv. visibility = "visible";
document.mydiv. display = "";
document.mydiv. style.display = "";
}
</script>

Can anyone tell me what the syntax really SHOULD be?

Eternal thanks in advance.

- Jon
Jul 20 '05 #1
4 2808
Jonathan wrote:
<a href='javascrip t:showMyDiv();' >Show mydiv</a>

<div id='mydiv' style='visibili ty:hidden;'>

However, when I click on the link (coded as above), the following
javascripts do not make the div appear. It works fine in Explorer.

mydiv.style.vis ibility = "visible"; // Works in IE, not Netscape

Can anyone tell me what the syntax really SHOULD be?


document.getEle mentById('mydiv ').style.visibi lity = 'visible';
Jul 20 '05 #2
Ivo
"Leif K-Brooks" wrote:
Jonathan wrote:
<a href='javascrip t:showMyDiv();' >Show mydiv</a>

<div id='mydiv' style='visibili ty:hidden;'>

However, when I click on the link (coded as above), the following
javascripts do not make the div appear. It works fine in Explorer.

mydiv.style.vis ibility = "visible"; // Works in IE, not Netscape

Can anyone tell me what the syntax really SHOULD be?


document.getEle mentById('mydiv ').style.visibi lity = 'visible';


or even:
if( document.getEle mentById && document.getEle mentById )
{ document.getEle mentById('mydiv ').style.visibi lity = 'visible'; }

Also, it may be worth repeating that 'javascript:' as the href of an <a> tag
should be avoided, unless you wish to present a bookmarklet. The link SHOULD
really look something like:

<a href="nojs.html " onclick="return showMyDiv();">S how mydiv</a>

and the function should explicitely return a boolean *false* value to stop
the href to the non-javascripted alternative resource being followed.
Better still is of course to dynamically document.write( ) the link to
prevent the javascriptless from seeing it in the first place.

--
Iv
Jul 20 '05 #3
Jonathan wrote:
<a href='javascrip t:showMyDiv();' >Show mydiv</a>
That's a rather bogus construct. What does this "link" do when js is
disabled? You're better off with "onClick" set to an element that is
only created via JavaScript. Thus, when it's disabled, there's nothing
there. When it's enabled, there's a button or some such thing that
toggles the visability of the div.
However, when I click on the link (coded as above), the following
javascripts do not make the div appear. It works fine in Explorer.

<script> function showMyDiv()


You've already got the answer you need. You might want to ask in a
javascript group next time, as this group is for html.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #4
Ivo wrote:
or even:
if( document.getEle mentById && document.getEle mentById )


Errrr.... huh? I presume there's a typo there, as:

A && A == A

--
Mark.
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3305
by: Ahmad Noori | last post by:
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>
3
29673
by: Jukka K. Korpela | last post by:
I have noticed that the meaning of visibility: collapse has been discussed on different forums, but with no consensus on what it really means. Besides, implementations differ. The specification says: "The 'visibility' property takes the value 'collapse' for row, row group, column, and column group elements. This value causes the entire row or column to be removed from the display, and the space normally taken up by the row or column to...
11
1400
by: Tery Griffin | last post by:
who can't get onload to fire at all in IE on a Mac? I¹m about to try the suggestion of adding the script after the body tag. I¹d really rather do it some ³right² way, if there¹s a right way that works . . . I have to admit that it¹s annoying to have to code around something that doesn¹t work in a browser that¹s no longer being supported on the platform. Unfortunately, we have a couple of labs full of Macs, and a lot of people like to...
4
5461
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) { document.getElementById(nameOfDiv).style.visibility='visible'; document.getElementById(nameOfDiv).style.height='auto'; if (nameOfDiv != 'weblogs')
1
2923
by: Keith Harris | last post by:
Hi, I have a Repeater control which is bound to a dataset. In the footer of the repeater control, I have a Button whose visibility I want to vary according to the sum of a column being > 0. I have tried to set the button's visibility in Page_Load (after data binding), but I get a NullReferenceException stating that "Object reference not set to an instance of an object".
3
1614
by: Dica | last post by:
i want to set up my aspx page with a hierarchical navigation system. first the user has to select to "-- Select An Action --", which could be either "Add Item" or "Edit Item". If the user selects "Edit Item", i show a list of items they can select. once selected, i show the input form, which has all the item details. conversely, if the user selects "Add Items", i skip showing the "Select Item" drop down and go straight to showing the item...
4
1655
by: Jon | last post by:
I'm looking for a way to toggle text without using client scripting. One way to go is by the visibility property and a click event, but this does a postback and returns to the top of the page. Is there a way around this? Jon Cosby
2
1969
by: celoftis | last post by:
Using VS2005, ASP.NET. Check out the tree view on this page: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.aspx When you hover over the border between the two frames, a tooltip displays: "Click and drag to resize. Double click or press 't' to toggle visibility."
1
1954
by: swiftouch | last post by:
I'm getting an error message in FF2.0: document.getElementById(toggle) has no properties The goal of the script is, when I hover my mouse over an image, to make one div element visible while making all the others div elements in the array, hidden. thisDocId is the element to avoid hiding. This is the script: <script>
0
8139
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8579
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8232
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8408
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6064
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5524
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.