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 Updates via RSS | E-post Get updates via feedburner Get updates via twitter
Home / Apps / Coding / JavaScript & Ajax / PHP / JavaScript: Get anchor from … Avaleht / Apps / kodeerimise / JavaScript ja Ajax / PHP / JavaScript: Get ankur alates ...

JavaScript: Get anchor from URL JavaScript: Get kinnistada saadud URL

Posted on 10. Postitatud 10. Jun, 2009 by Dragos in Apps , Coding , JavaScript & Ajax , PHP Juuni, 2009 Dragos in Apps, kodeerimine, JavaScript ja Ajax, PHP

To get the anchor from an URL (this is the text after the # character) in JavaScript you can use the following code: Et saada kinnistada saadud URL (see on teksti pärast # märk) on JavaScripti saate kasutada järgmist koodi:

 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 "/ / Kui teil on vaja võtta praegune URL aknas kasutada: var url = window.location;
var anchor=url.hash; //anchor with the # character var anchor = url.hash; / / ankur koos # märk
var anchor2=url.hash.substring(1); //anchor without the # character var anchor2 = url.hash.substring (1), / / Anchor ilma # märk 

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: Kui olete iterating kaudu linkide lehele jQuery ja $ (this) määratleb ühe lingi siis leida ankur Selle objekti soovite, tuleb kasutada järgmist koodi:

 var anchor=$(this).attr("hash"); var anchor = $ (this). attr ( "räsi"); 
Translate this post Tõlgi see postitus


Related posts: Seonduvad postitused:

  1. Javascript: How to validate email address with JavaScript? Javascript: Kuidas kinnitada e-posti aadress JavaScript?
  2. JavaScript: How to get the index (position within a group) of an object with jQuery? Javascript: Kuidas saada indeks (seisukoha rühma) objekti jQuery?
  3. JavaScript: Send function as a parameter to another function (callbacks) Javascript: Saada funktsiooni parameeter teise funktsiooni (kutse,)
  4. JavaScript: What if jQuery animation doesn't fire/start? Javascript: Mida teha, kui jQuery animatsioon ei tule alustada?
  5. JavaScript: GIFless animation. Javascript: GIFless animatsioon. Animate images,logos with jQuery Animeeritud piltide, logode jQuery

    blog comments powered by Disqus blog comments powered by Disqus