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 अद्यतन Via आरएसएस | ईमेल Get updates via feedburner Get updates via twitter
Home / Apps / Coding / JavaScript & Ajax / PHP / JavaScript: Get anchor from … घर / Apps / कोडिंग / जावास्क्रिप्ट और Ajax / PHP / जावास्क्रिप्ट: से लंगर प्राप्त करें ...

JavaScript: Get anchor from URL जावास्क्रिप्ट: URL से लंगर जाओ

Posted on 10. 10 पर तैनात हैं. Jun, 2009 by Dragos in Apps , Coding , JavaScript & Ajax , PHP जून, 2009 Apps, कोडिंग, जावास्क्रिप्ट और Ajax, PHP में Dragos द्वारा

To get the anchor from an URL (this is the text after the # character) in JavaScript you can use the following code: एक URL से लंगर मिल (यह चरित्र # बाद पाठ इस प्रकार है) जावास्क्रिप्ट में आप निम्नलिखित कोड का उपयोग कर सकते हैं:

 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 ', / / यदि आप खिड़की के प्रयोग के चालू यूआरएल ले: var url window.location = की जरूरत है;
var anchor=url.hash; //anchor with the # character var लंगर url.hash =; / # चरित्र के साथ लंगर /
var anchor2=url.hash.substring(1); //anchor without the # character var anchor2 = url.hash.substring (1); # चरित्र के बिना लंगर / / 

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: यदि आप JQuery के साथ एक पृष्ठ में लिंक के माध्यम से iterating हो, और ($ इस) एक कड़ी को परिभाषित करता है, तो इस उद्देश्य के लंगर आपको निम्न कोड का प्रयोग करना चाहते हैं पता:

 var anchor=$(this).attr("hash"); var लंगर = ($ इस attr). ( "हैश"); 
Translate this post अनुवाद इस पोस्ट


Related posts: संबंधित पोस्ट:

  1. Javascript: How to validate email address with JavaScript? : जावास्क्रिप्ट कैसे जावास्क्रिप्ट के साथ ईमेल पते की पुष्टि के लिए?
  2. JavaScript: How to get the index (position within a group) of an object with jQuery? : जावास्क्रिप्ट कैसे सूचकांक प्राप्त करने की स्थिति एक समूह के भीतर (jQuery के साथ एक वस्तु का)?
  3. JavaScript: Send function as a parameter to another function (callbacks) जावास्क्रिप्ट: एक और समारोह callbacks (एक पैरामीटर के रूप में कार्य भेजें)
  4. JavaScript: What if jQuery animation doesn't fire/start? जावास्क्रिप्ट: क्या होगा यदि jQuery एनीमेशन नहीं आग / शुरू कर दिया?
  5. JavaScript: GIFless animation. जावास्क्रिप्ट: GIFless एनीमेशन. Animate images,logos with jQuery सजीव चित्र, jQuery के साथ लोगो

    blog comments powered by Disqus ब्लॉग टिप्पणियों Disqus द्वारा संचालित