CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    568

    getElementByName parameter

    Hello everyone

    Just for example, instead of using MS's mynode.all to get a collection of all the elements inside some node we use mynode.getElementsByTagName("*").
    I am wondering: is there a simple and short way to get desired element by its name using name pattern (something like getElementsByName("myName*") for ex.)?

    Thanks in advance =)

    P.S. Please, don't offer iterations through the elements with name comparison...
    Last edited by Xeel; May 12th, 2009 at 03:31 PM.
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)

    //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));

    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: getElementByName parameter

    Of course there is...

    Code:
    document.getElementsByName()
    Remember that multiple elements can have the same name. Therefore, this will return an array, not just the actual element object.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    568

    Re: getElementByName parameter

    Of course there is...
    Khmm, khmm...
    LOL! Ok, my mistake I should have foreseen this... =)
    But I wonder... How could you, after all this time, even assume this...

    Look at this thread title... See anything there? Ok, ok, I've just missed 's' there (quick typing, you know...)

    Just kidding. I know this method. My question was about its parameter. Or any other similar solution using some other method.
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)

    //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));

    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: getElementByName parameter

    We all make mistakes...I just read your post too fast.

    The correct answer is no. No wildcards exist in this circumstance. You are going to have to walk the DOM recursively toget this, or weed through the arrays returned by getElementsByName.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    568

    Re: getElementByName parameter



    Will write my own method then...
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)

    //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));

    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured