+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14

Thread: Absolute Positioning relative to textbox

  1. #11
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    OK. I finally got it sorted.

    I used the following code:-
    JS
    Code:
    function autoComplete(txtbox,listholder,type)
    {
        var txt = document.getElementById(txtbox);
        var list = document.getElementById(listholder);
        if (txt.value.length <= 0) {
            list.style.display = 'none';
        } else {
            var posLeft = findPos(txt)[0];
            var posTop = findPos(txt)[1];
                list.style.left = posLeft;
                list.style.top = (posTop+txt.offsetHeight);
                list.style.display = '';
        }
    }
     
    function findPos(obj) {
        var oNode = obj;
        var curleft = 0;
        var curtop = 0;
        if (obj.offsetParent) {
            do {
                curleft += obj.offsetLeft;
                curtop += obj.offsetTop;
            } while (obj = obj.offsetParent);
        }
        return [curleft, curtop];
    }
    
    The thing that finally sorted it was putting the autocomplete div holder as the final element on my page. ie I placed it on my master page, just above the </form> tag.

    The absolute positioning then works.

    Just need to sort out the disappearing behind dropdownlists issue...

    <edit>Actually, just found that this isn't working in FF..</edit>

  2. #12
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    R, I'm afraid there is no solution for the disappearing behind dropdownlists.

    Can you maybe run some conditional code so that it will do one thing for FireFox and another for IE6?

    Also, is this being developed for a company intranet or for the Internet? The reason I'm saying this is that even Facebook is now posting a notice saying that it's time to freakin' upgrade your browser. I think all developers should start forcing ignorant users to upgrade their browsers. IE8 is already out...there is no excuse for using IE6 still.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #13
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Quote Originally Posted by jmurrayhead View Post
    R, I'm afraid there is no solution for the disappearing behind dropdownlists.

    Can you maybe run some conditional code so that it will do one thing for FireFox and another for IE6?

    Also, is this being developed for a company intranet or for the Internet? The reason I'm saying this is that even Facebook is now posting a notice saying that it's time to freakin' upgrade your browser. I think all developers should start forcing ignorant users to upgrade their browsers. IE8 is already out...there is no excuse for using IE6 still.
    Sorry J. I was referring to the positioning. I think the only way is going to be some conditional stuff....Not entirely sure why this now works in IE6, but not in FF...

    It's for the internet. I just think it would make sense to cover off IE6 as well...

  4. #14
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Yeah, I know a lot of people are still trying to support IE6...but it's a tad ridiculous with the way Internet technology is changing. IMO, it's time to dump IE6 and force these idiots to upgrade.

    Anyway, I think the conditional coding is the proper solution for this.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. textbox events
    By todd2006 in forum .NET Development
    Replies: 12
    Last Post: April 13th, 2009, 09:16 AM
  2. CSS positioning woes...
    By bryceowen in forum HTML & CSS Help
    Replies: 9
    Last Post: February 25th, 2009, 12:18 PM
  3. validate empty textbox js
    By tulz in forum JavaScript Programming
    Replies: 1
    Last Post: February 11th, 2009, 06:13 AM
  4. textbox validation
    By todd2006 in forum JavaScript Programming
    Replies: 6
    Last Post: July 2nd, 2008, 02:30 PM
  5. Textbox or List help
    By Rebelle in forum JavaScript Programming
    Replies: 9
    Last Post: April 21st, 2008, 11:00 AM

Tags for this Thread

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

SEO by vBSEO