codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  getelementbyclass? does that actually exist/work  Ironfistchamp at 20:15 on Thursday, April 20, 2006
 

I have seen it used in theory but I can't get it to work.

Take this code for example

<div class="menuitem">
<a href="#" onClick="menu()">SHOWIT</a>
<div id="me">HELLO</div>
<div name="subitem" class="subitem">HELLO AGAIN</div>
</div>

Now if the menu function is

function menu()
{
document.getElementById(me).style.visibility = "visible";
}

Then clicking the link shows the hidden div "me".

If it is

function menu()
{
document.getElementByClass('subitem').style.visibility = "visible";
document.getElementById('me').style.visibility = "visible";
}

Or

function menu()
{
document.getElementByClass('subitem').style.visibility = "visible";
}

Nothing is shown. What am I doing wrong? Anybody know?

Thanks

Ironfistchamp








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Making a simple game
•  Re: Conversion
•  disable radio button
•  problem with recurssion
•  session values
•  Re: array names
•  how to call java script function in input tag ,that java script function written in another javascript file
•  Re: button color
•  Access denied error when submit form


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006