Using AddThis Parameters with .NET

Microsoft's .NET framework has a problem with HTML attributes that have colons in them. An easy workaround for this is to echo the attribute using <%= tags, like this:

<a class="addthis_button_facebook_like"  <%="fb:like:layout"%>="standard"></a>

Or you can add the attributes using JavaScript like this:

<div class="addthis_toolbox addthis_default_style ">
    <a class="addthis_button_facebook_like" id="like-button"></a>
</div>
<script type="text/javascript">
e = document.getElementByID('like-button');
e.createAttribute('fb:like:send', 'true');
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4da371d82c643e7b"></script>

It's important to have the addthis_widget.js file after the attribute is added.

Still need help?


General Topics

 

Developers