SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: AJAX Help

  1. #1
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    germany
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AJAX Help

    Hello
    I am using asp.net Atlas feature to list autocomplete text items under a text box. but atlas supports only a standardised function which accepts the keyword and the no of characters within its function.

    So i created my own javascript function on the keypress event of the text box and called a webservice and loaded that text returned by that function on to the DIV. The text loads perfectly but i am not able to select the text as well as i am not able to put the text selected into the text box.
    How to do this using javascript.

    Thanks in advance for the reply

    with regards
    Knowledge is all about Sharing

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't know Atlas, maybe you should head over to the Atlas forums for help?

  3. #3
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    germany
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is not Atlas. It is just how to get the value listed in a DIV tag into the text box.

    Thanks
    Knowledge is all about Sharing

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    var oDiv = document.getElementById("myDiv");
    var oInput = document.getElementById("myInput");
    
    oInput.value = oDiv.innerText || oDiv.textContent;
    Last edited by Pepejeria; Jun 6, 2006 at 11:34.

  5. #5
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    germany
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Peperjeria,
    Thanks for the reply
    That works but it takes all the listed items into the text box , in other words it pulls all the string or listed items within the div into the text box.
    I just want to pull only the item i clicked.

    Thanks in advance for the answer
    Knowledge is all about Sharing

  6. #6
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, you need a completely different approach for that then.

    Is each item wrapped into a div, or span?

  7. #7
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    germany
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no
    i am making a array in my webservice and return the string array and write the string to the DIV ID which is below the text box.
    Now it list all the items and what i need is to select the item which is clicked by the user.
    Knowledge is all about Sharing

  8. #8
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but how does the HTML for that look?

  9. #9
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    germany
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <form name="form1">
    <center>
    <input name="keyword" onKeyUp="SendQuery(this.value)" style="WIDTH:500px" autocomplete="off">
    <div align="left" class="box" atomicselection="false" onmousedown="clickit(this)" id="autocomplete" unselectable="off" visible="false" style="WIDTH:500px;BACKGROUND-COLOR:#ccccff"></div>
    </center>
    </form>
    String Format
    Response.Write("<strong>" + row["SrchName"].ToString() + "</strong> <i>" + row["SrchDescription"].ToString() + "</i>: " + meaning + "<br>");
    Knowledge is all about Sharing


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
  •