Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9235897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:09:39+00:00 2026-06-18T07:09:39+00:00

I’m trying to narrow down some web code for a new site I’m making.

  • 0

I’m trying to narrow down some web code for a new site I’m making. I found this answer that seems to be what I am looking for, but I can’t get it to work: https://stackoverflow.com/questions/13483194#13483649

I was trying the non-jQuery answer, but I seem to be missing something, as it doesn’t do anything when I load the page into Firefox and press the button. I am using phpDesigner software, copy pasting into a .htm file and then running in Firefox.

Here is the code I did:

JavaScript:

// https://stackoverflow.com/a/5158301/74757
function getParameterByName(name, path) {
    var match = RegExp('[?&]' + name + '=([^&]*)').exec(path);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}

var hiddenElHtml = document.getElementsByClassName('hidden_elem')[0].innerHTML.replace('<!--', '').replace('-->', '');

var divObj = document.createElement('div');
divObj.innerHTML = hiddenElHtml;

var itemAnchor = divObj.getElementsByClassName('itemAnchor')[0];
var href = itemAnchor.getAttribute('href');

var fbId = getParameterByName('h', href);

alert(fbId);

HTML:

<code class="hidden_elem" id="ukftg4w44">
    <!-- <div class="mtm mlm">
     ...
      ....
    <span class="itemLabel fsm">Unfriend...</span></a></li>
    <li class="uiMenuItem" data-label="Report/Block...">
    <a class="itemAnchor" role="menuitem" tabindex="-1" href="/ajax/report/social.php?content_type=0&amp;cid=1352686914&amp;rid=1352686914&amp;ref=http%3A%2F%2Fwww.facebook.com%2F%3Fq&amp;h=AfjSxEzzdTSrz-pS&amp;from_gear=timeline" rel="dialog">
    <span class="itemLabel fsm">Report/Block...</span></a></li></ul></div>
     ....
    ...
    </div> -->
</code>

<button onclick="getParameterByName()">Try it</button>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:09:41+00:00Added an answer on June 18, 2026 at 7:09 am

    Your almost done it, look to this fiddle, its working:
    http://jsfiddle.net/promatik/qyeWT/

    I put all your code in a function, getAttributes() and I’ve added another attribute just to better test your problem:

    var fbId = getParameterByName('h', href);
    var cId = getParameterByName('cid', href);
    
    document.getElementById('parameter-h').innerHTML  = fbId;
    document.getElementById('parameter-cid').innerHTML  = cId;
    
    alert(fbId + "\n" + cId);
    

    HTML:

    <div><span>HREF = </span><span id="parameter-h"></span></div>
    <div><span>CID = </span><span id="parameter-cid"></span></div>
    <button id="tryagain">Try it</button>
    

    And the button has an eventlistener:

    document.getElementById("tryagain").addEventListener("click", getAttributes, false); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.