Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: How to get DHTML box to appear?

  1. #1
    Join Date
    Aug 2006
    Location
    Dubai, UAE
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to get DHTML box to appear?

    Like on this page: http://finance.google.com/finance, once you enter in a search query, it will have a little DHTML box that appears with some info, how can I duplicate this?

    TIA!

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    You could use an Iframe:

    Code:
    <a href="http://www.mamma.com/" target="win">Open</a>
    <br><iframe name="win"></iframe>
    - Mike

  3. #3
    Join Date
    Aug 2006
    Location
    Dubai, UAE
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by mburt
    You could use an Iframe:

    Code:
    <a href="http://www.mamma.com/" target="win">Open</a>
    <br><iframe name="win"></iframe>
    Any ideas on how I can get it to appear like on another layer. Like a popup box.

  4. #4
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you are talking about the auto suggest then that's AJAX not DHTML, Simple DHTML cannot send data back and forth the server(except using the hidden iframe technique). Try reading this: http://www.dynamicajax.com/fr/AJAX_S...1_290_312.html

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Try this:

    Code:
    <html>
    <head>
    <script>
    //er... this is a combination of Twey and jscheuer1's script
    function getFile(filename)
      { oxmlhttp = null;
        try
          { oxmlhttp = new XMLHttpRequest();
            oxmlhttp.overrideMimeType("text/xml");
          }
        catch(e)
          { try
              { oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              }
            catch(e)
              { return null;
              }
          }
        if(!oxmlhttp) return null;
        try
          { oxmlhttp.open("GET",filename,false);
            oxmlhttp.send(null);
          }
        catch(e)
          { return null;
          }
        return oxmlhttp.responseText;
      }
    
    function getData(file){
    return getFile(file)
    }
    </script>
    </head>
    <body>
    <div style="border:1px solid black;width:200px;height:200px;overflow:scroll">
    <script>document.write(getData('http://www.mamma.com'))</script>
    </div>
    </body>
    </html>
    - Mike

  6. #6
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    mburt: First thing: that will not work because:

    1) it does not have a server side page to make the HTTP query,
    2) document.write just overrides the whole page, use innerHTML instead,
    3) to make queries over domains you need cross domain ajax(you cannot simply use http://mamma.com/ until it is your domain).

    That code will not work believe me. And by the way that code is not correct. mburt: you better read this: Hello World in AJAX

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    document.write just overrides the whole page, use innerHTML instead
    document.write doesn't override the whole page within the <body>. it simply adds whatever is necessary. I will take into account what you have said though.
    - Mike

  8. #8
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That link I included could be useful for you.

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Okay, thanks.
    - Mike

  10. #10
    Join Date
    Aug 2006
    Location
    Dubai, UAE
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for all of the feedback!

    I already have my AJAX framework in place, and its sending the data back and forth, however, I was unable to get the box or window to appear and "float" over my page, like the Google page had shown.

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
  •