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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'style.display' is null or not an object

Status
Not open for further replies.

breeb

Programmer
Jul 8, 2003
25
ZA
I am pretty new to Javascript and trying to display a result set from a database when the user clicks on a word. My javascript function is:
<SCRIPT>
function toggle(e)
{
if (e.style.display == &quot;none&quot;)
{
e.style.display = &quot;&quot;;
}
else
{
e.style.display = &quot;none&quot;;
}

}
</SCRIPT>

and the relevant parts of my html code are:

<div style = &quot;cursor: hand&quot; onClick = &quot;toggle(document.all.HideShow);&quot;>
View
</div>

<span style = &quot;colour: blue&quot; id = HideShow>
**the data that I want to display**
</span>

I am using IE 5.5, however this code would need to run on various different versions.

Any help??

 
anytime you need to have a object be browser friendly you do not want to use document.all
this is a IE only statement
after changing the parameter to
<div style=&quot;cursor:hand&quot; onClick=&quot;toggle(document.getElementById('HideShow'));&quot;>

it works fine in NN6+ and IE5+

O' the cursor:hand is not valid in NN I believe. not sure on that one though. Also, colour may need to be spelled color. I know it is spelled both ways but the browser will not recognize it I think.

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-3811

onpnt2.gif
 
Thank you! At the moment it is only hiding/displaying the first row in the table, but I think that it just needs some of the tags to be changed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top