Hi,
I'm not too javascript-savy
I have an external .js file which I use on multiple webpages. I'd like to include the html-code below in this file, but can't seem to figure out how.
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */
</script>
<a class="FlattrButton" style="display:none;"
href="http://www.somewebsite.com"></a>
Could anyone guide me?
I guess the last bit of code would look like this:
document.write('<a class="FlattrButton" style="display:none;"href="http://www.somewebsite.com"></a>')
But how do I implement the javascript within an external javascript file? Any ideas?
Thanks for your help!
I know how to CALL the file:
<script language="JavaScript" src="http://www.somewebsite.com/myfile.js"></script>
My problem is that I can't get the code in the 'myfile.js' to work properly. Any ideas of how the code in the external .js file should look like?
I'm not too javascript-savy

I have an external .js file which I use on multiple webpages. I'd like to include the html-code below in this file, but can't seem to figure out how.
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */
</script>
<a class="FlattrButton" style="display:none;"
href="http://www.somewebsite.com"></a>
Could anyone guide me?
I guess the last bit of code would look like this:
document.write('<a class="FlattrButton" style="display:none;"href="http://www.somewebsite.com"></a>')
But how do I implement the javascript within an external javascript file? Any ideas?
Thanks for your help!
I know how to CALL the file:
<script language="JavaScript" src="http://www.somewebsite.com/myfile.js"></script>
My problem is that I can't get the code in the 'myfile.js' to work properly. Any ideas of how the code in the external .js file should look like?