Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
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
function collapse(div) {
    var currentdiv = document.getElementById(div);
    currentdiv.style.zIndex = 3;
and code from the html document calls that function like
<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
Old 9th March 2009, 17:18
id10t id10t is offline
Senior Member
Join Date: Nov 2008
Posts: 242
Thanks: 2
Thanked 22 Times in 22 Posts

javascript is typeless, so a variable holds whatever data of whatever type you stick into it


Though... need the $div to references the variable created.
Reply With Quote


getelementbyid, javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Freebsd 6.1 support misterm Installation/Configuration 10 9th April 2009 10:29
Help with Bluetooth PAND josto HOWTO-Related Questions 1 7th August 2007 21:53
2.4.17 system needed modul8r Installation/Configuration 16 31st May 2007 15:15
SuSE Enterprise, PHP binary coming with ISPConfig does not work properly NexusTechUS Installation/Configuration 1 26th April 2007 21:03
Oh crap... Corrupted install TheMJ Installation/Configuration 4 17th February 2006 18:59

All times are GMT +2. The time now is 19:29.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.