Hello everyone,
I am trying to change a div content on the fly when buttons are clicked. I use a javascript function for that. It is fine as long as the div content is just text, images and regular html.
One button, however, is supposed to show someone’s twitter updates using the code harvested on twitter.com. I tried to put the twitter widget javascript code inside of a variable but it’s not working. Is it at all possible to include <script></script> tags in side javascript code?
Here is my javascript function:
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
Here is what goes on the button:
<a href=”javascript:ReplaceContentInContainer(‘content’, twtr_updates)”><img src=”button.jpg” /></a>
[I]the div content is stocked in the ‘twtr_updates’ variable.
Now here is the Twitter widget code:
<script src=”
<script>
new TWTR.Widget({
version: 2,
type: ‘profile’,
rpp: 4,
interval: 6000,
width: 250,
height: 300,
theme: {
shell: {
background: ‘#333333’,
color: ‘#ffffff’
},
tweets: {
background: ‘#000000’,
color: ‘#ffffff’,
links: ‘#4aed05’
}
},
features: {
scrollbar: false,
loop: false,
live: false,
hashtags: true,
timestamp: true,
avatars: false,
behavior: ‘all’
}
}).render().setUser(‘InnotechNutri’).start();
</script>
Thank you in advance.