Search Results

Search found 1 results on 1 pages for 'user1420493'.

Page 1/1 | 1 

  • Javascript is freezing the browser when running this code

    - by user1420493
    I am trying to get the value of a text input and check if there is any links in it and then take those links and make them into tags. But when I run this code, something is going wrong and it completely freezes the page. Basically, I want it to check for "http://" and if that exists, to keep on adding to the substr length until the end of the string/link. Is there a better way to do this? // the id "post" could possibly say: "Hey, check this out! http://facebook.com" // I'd like it to just get that link and that's all I need help with, just to get the // value of that entire string/link. var x = document.getElementById("post"); var m = x.value.indexOf("http://"); var a = 0; var q = m; if (m != -1) { while (x.value.substr(q, 1) != " ") { var h = x.value.substr(m, a); q++; } }

    Read the article

1