View Single Post
  #1  
Old 24th January 2009, 06:32
CMYK CMYK is offline
Junior Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default how do I tell javascript what type of data I'm passing to a function?

I have a function that goes like
Code:
function collapse(div) {
    var currentdiv = document.getElementById(div);
    currentdiv.style.zIndex = 3;
}
and code from the html document calls that function like
Code:
<a onclick="collapse('pictures')">pictures</a>
where pictures is the name of a <div> later on that had the id of pictures. Anyway, how can I tell Javascript that I'm passing a string so that the document.getELementById part will work? For example, the code will work if I write in document.getElementById("pictures");.
Reply With Quote
Sponsored Links