Advanced Search

Results 1 to 2 of 2

Thread: Multiple IDs in getElementByIDs

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Multiple IDs in getElementByIDs

    Hey i am new to javascript and trying to modify this
    <script type="text/javascript">
    document.onclick=check;
    function check(e){
    var target = (e && e.target) || (event && event.srcElement);
    var obj = document.getElementById('content');
    checkParent(target)?obj.style.display='none':null;
    }
    function checkParent(t){
    while(t.parentNode){
    if(t==document.getElementById('content')){
    return false
    }
    t=t.parentNode
    }
    return true
    }
    </script>

    basically i have two divs with different ids i need to have this functionality on both the divs. when i am putting the script for a single div its works fine. my question is how can i have the functionality with two different divs having two different ids.
    please help
    thanks in advance

  2. #2
    Join Date
    Jan 2008
    Posts
    4,158
    Thanks
    28
    Thanked 623 Times in 619 Posts
    Blog Entries
    1

    Default

    Please only post one thread, posting more then one will not get anymore attention.
    Jeremy | jfein.net

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
  •