SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2002
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing ID to function

    Is it possible to pass the ID of some element to a function to use with document.all or getElementById?
    Something like this does not work:

    function doSomething(some_id){
    document.all("some_id")...
    document.getElementById("some_id")...
    }

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't use quotes....
    Code:
    function doSomething(some_id){
       document.all(some_id) ...
       document.getElementById(some_id) ...
    }
    //which you call like this:
    doSomething('elementID');
    ----Adopt-a-Sig----
    Your message here!

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2002
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, of course, thx


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •