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

  • Home
  • SEARCH
  • 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 6535379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:22:00+00:00 2026-05-25T10:22:00+00:00

im using the http://sharethis.com/ buttons to give users on a website a simple way

  • 0

im using the http://sharethis.com/ buttons to give users on a website a simple way to share content.

They have information on “custom buttons” here: http://help.sharethis.com/customization/custom-buttons

It looks like to specify the URL, in the example all they have its just html like this:

<span class="st_sharethis" st_url="http://mycustomurl.com" st_title="Sharing Rocks!"
displayText="ShareThis"></span>

But I need to be able to dynamically create buttons on the fly without reloading the page.

So, In a flash application i’m building i have a “share button” that triggers a javascript function on the webpage that makes a “popup” div fade into the center of the screen that I want to display the share buttons. Depending on what share button someone clicks it will need to have a dynamically created URL.

It’s important if they close the dialog, then click the share button again, im hoping the code will just overwrite the old code with new buttons, with the new url/titles.

So, i created this javascript function that I call from flash, while passing the url from flash. I placed the script and everything inside my “popup” div, hoping that the buttons will be rendered inside that div.

function shareChannel(theurl)
{
//I cant seem to find an example of what to put here to load the buttons, and give them a custom URL and title

//finally display the popup after the buttons are made and setup.
displaypopup();
}

could anyone possibly post an example of how I might be able to do this without ever reloading the page?

EDIT:
@Cubed

<script type="text/javascript">
function shareChannel(chaan)
          {

          document.getElementById('spID1').setAttribute('st_url', 'http://mycustomurl?chan='+chaan);
          document.getElementById('spID1').setAttribute('st_title', 'Custom Title is ['+chann+'] it works!');

          stButtons.locateElements();

          centerPopupThree();
          loadPopupThree();
          }

</script>

Basically nothing happens. I hate using javascript because I really have no idea how to get error messages or debug. When I work with flex, I have a great debugger/console to messaround with. So, sorry im having trouble providing more info. I did notice when I remove just the

document.getElementById('spID1').setAttribute('st_url', 'http://mycustomurl?chan='+chaan);
              document.getElementById('spID1').setAttribute('st_title', 'Custom Title is ['+chann+'] it works!');

The popup appears.

But if I have the above setAttribute code inside the function, the popup never appears, so im assuming something in that code is breaking it. Any suggestions? Or at least a way I could use chrome to tell me what the error is? I tried the inspect element console but there was nothing that appeared there when i triggered the function.

Also, in at the top of my code they had me use:

    <script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js">
</script><script type="text/javascript">stLight.options({publisher:'mypubidgoeshere'});</script>

Should I be using
stLight.locateElements(); rather than stButtons.locateElements();

  • 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-05-25T10:22:01+00:00Added an answer on May 25, 2026 at 10:22 am

    I’ve been using the

    stButtons.locateElements();
    

    function to generate any new buttons after loading content via AJAX, I imagine it will work for this too.

    This question might be of some assistance also:

    Sharethis button does not work on pages loaded via ajax

    Better Solution:

    Make your <div> and make sure all the <span>s have IDs, otherwise you can give them classes but you will need to iterate through them all.

    function shareChannel(theurl, thetitle)
        {
        document.getElementById('spanID1').setAttribute('st_url', theurl);
        document.getElementById('spanID1').setAttribute('st_title', thetitle);
    
        stButtons.locateElements();
    
        //finally display the popup after the buttons are made and setup.
        displaypopup();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using http://urlrewriter.net/ to rewrite urls at my website. For example, I'm rewriting: http://www.example.com/schedule.aspx?state=ca
I'm using http://maps.google.com/maps/geo ? web service to geocode some addresses. The problem I have
I'm using http://github.com/lakshmivyas/hyde to generate my website, and it included .htaccess mod_rewrite rules, but
I'm using http://github.com/lakshmivyas/hyde to generate my website, and it included .htaccess mod_rewrite rules, but
I'm using http://github.com/lakshmivyas/hyde to generate my website, and it included .htaccess mod_rewrite rules, but
I am using http://code.google.com/p/jquery-ui-map/ I am trying to find a way when looping through
Using http://github.com/archiloque/rest-client When posting a file using this line, the content type is set
I am using http://www.phpletter.com/Our-Projects/AjaxFileUpload/ ajax file upload plugin. Is there any way of passing
I am using: http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx#Y2160 to connect and get information from a server. This is
I'm using http://code.google.com/p/flex-iframe/ for showing html in an flex application. To set this up

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.