Results 1 to 3 of 3

Thread: Limiter

  1. #1
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Limiter

    i have this txt file name contacts.txt that contains this:

    kate|female|kathryn bailey beckinsale|26-jul-1973|#23 underworld drive|(621) 142-7827|kate@lycans.net
    jessica|female|jessica claire biel|03-mar-1982|27 texas avenue|(53)2344223|jbiel@yahoo.com
    johnny|male|john christopher depp ii|09-jun-1963|711 pirate road|(773) 476-6634|jsparrow@piratebay.org


    my script is this:

    Code:
    function syncText() {
                    var xhr = new XMLHttpRequest();
                    
                    xhr.open("get", "data/contacts.txt", false);
    
                    xhr.send(null);
                    
                    if (xhr.status == 200) {
                        var data = xhr.responseText;
                        var items = data.split("|");
                        items.sort();
                        
                        var div = document.getElementById("header2");
                        for (var i = 0; i < items.length; i++) {
                            var p = document.createElement("p");
                            var text = document.createTextNode(items[i]);
                            p.appendChild(text);
                            div.appendChild(p);
                        }
                    } else {
                        alert("data retrieval failed...");
                    }
                }
    html:
    HTML Code:
            <div id="header2">
    		<button onclick="syncText()">Pak</button>	
    	</div>
    and my problems is how to select only the name in the contacts.txt (i only want kate, jessica, johnny) to be shown and not all.. please help...
    Last edited by keyboard; 02-06-2013 at 05:50 AM. Reason: Format: Code Tags [code][/code], Html Tags [html][/html]

  2. #2
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    why is there no reply in my post?? is there nobody out there?

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    It looks like a valid post. You seem to ask your question clearly although keyboard1333 had to clean up your post somewhat to make it readable. It might help to give your thread a more descriptive title. Other than that sometimes people are just busy with other posts and occasionally some posts get neglected. It happens. In my experience this is most likely to happen in the MySQL forum and much less likely to happen in the javascript forum. Speaking for myself, I have not answered your thread because I am not knowledgeable in javascript.

    At first glance this looks like it could easily be solved using php with an explode() function of the pipe symbol and the line break. This type of information looks better suited to being stored in a database as well. How do you plan on using this information? I am not saying that I am going to answer your question, especially since I have only dabbled a little bit with javascript in the past, but answering that might help someone else who is looking at this thread. What have you tried so far to solve this?
    Last edited by james438; 02-08-2013 at 05:27 PM.
    To choose the lesser of two evils is still to choose evil. My personal site

Similar Threads

  1. Form field Limiter
    By avidcat in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 08-03-2008, 05:24 AM
  2. Form field Limiter Help?
    By Hip_Hip_Array in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 02-15-2007, 03:02 PM
  3. Textarea Input Limiter
    By icesolid in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-23-2006, 04:45 PM
  4. Textarea Limiter
    By icesolid in forum JavaScript
    Replies: 1
    Last Post: 03-23-2006, 04:45 PM
  5. Form field Limiter IE NS6!
    By jscheuer1 in forum Bug reports
    Replies: 2
    Last Post: 03-16-2005, 10:21 AM

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
  •