This is a translated page. The original can be found here: http://iwebdevel.com/2009/06/10/javascript-get-anchor-from-url/
UPDATES VIA RSS | Email GÜNCELLEME VIA RSS | E-posta Get updates via feedburner Get updates via twitter
Home / Apps / Coding / JavaScript & Ajax / PHP / JavaScript: Get anchor from … Ana Sayfa / Apps / Kodlama / JavaScript & Ajax / PHP / JavaScript: den çapa al ...

JavaScript: Get anchor from URL JavaScript: URL'den çapa alın

Posted on 10. 10 olarak gönderildi. Jun, 2009 by Dragos in Apps , Coding , JavaScript & Ajax , PHP Haziran, 2009 Apps, Kodlama, JavaScript ve Ajax, PHP ve Dragos tarafından

To get the anchor from an URL (this is the text after the # character) in JavaScript you can use the following code: Bir URL'den çapa almak için (bu # karakterden sonra metin) JavaScript aşağıdaki kodu kullanabilirsiniz:

 var url='http://iwebdevel.com/some-post#comment-1'; //if you need to take the current url of the window use: var url=window.location; var url = 'http://iwebdevel.com/some-post # comment-1'; / / eğer pencere kullanım mevcut url almak için: var url = window.location gerekir;
var anchor=url.hash; //anchor with the # character var anchor = url.hash; # karakteri ile / / çapa
var anchor2=url.hash.substring(1); //anchor without the # character # karakteri olmadan var anchor2 = url.hash.substring (1); / / çapa 

If you're iterating through the links in a page with JQuery, and $(this) defines a single link, then to find the anchor of this object you'd need to use the following code: Eğer JQuery ile bir sayfadaki bağlantıları sayesinde, iterating konum ve $ (bu), daha sonra bu nesnenin size aşağıdaki kodu kullanabilirsiniz gerekiyordu çapa bulmak için tek bir bağlantı tanımlar:

 var anchor=$(this).attr("hash"); var anchor = $ (this). attr ( "hash"); 
Translate this post Translate bu yazı


Related posts: Ilgili posta:

  1. Javascript: How to validate email address with JavaScript? Javascript: Nasıl JavaScript ile e-posta adresinizi doğrulamak için?
  2. JavaScript: How to get the index (position within a group) of an object with jQuery? JavaScript: jQuery ile nasıl bir nesnenin (konum bir grup içinde) kütüğü almak için?
  3. JavaScript: Send function as a parameter to another function (callbacks) JavaScript: başka bir işlev (geriçağırımları) bir parametre olarak işlev gönder
  4. JavaScript: What if jQuery animation doesn't fire/start? JavaScript: Ya jQuery animasyon olmayan yangın / başlar?
  5. JavaScript: GIFless animation. JavaScript: GIFless animasyon. Animate images,logos with jQuery Animate görüntüler, jQuery ile logolar

    blog comments powered by Disqus Blog Yorumlar Disqus tarafından desteklenmektedir