Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: split replace '

  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts

    split replace '

    Code:
      dropDownPart.innerHTML = tmpInnerHTML;
    how does this tmpInnerHTML gets filled :

    Code:
    for (var i = 0; i < arr.length ; i++)
    {
            var arr1 = arr[i].split('|');
            id_tezaver = arr1[0];                  
            term = arr1[1]  
            // if  arr1[1] contains ',   then ewerything after that disapears inside term,
            // like "bird's eyes"  becomes  "bird"
            // how to handle that  ?
           
            // bad example how I get to verify that the stuff is complete inside array
            // term = arr1[1].replace(/'/i, /oo/); 
    
    }

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    Code:
    if(arr1[1].indexOf("'")!=-1) term=arr1[1].substring(0,arr1[1].indexOf("'"));
    else term=arr1[1];

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    innerHTML is not a standard DOM method. It will not always read/insert the elements or their attributes from/to the DOM tree. Take care of.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •