Executing JavaScript code inside Blogger posts
Now this is a really cool hack, and it runs on both IE and FireFox. As you may have noticed, Blogger does not allow for <script> tags inside posts. However, a workaround is to use DOM scripting and the JavaScript eval() function, in order to execute the code inside some other tag. Just place something like this in the HEAD part of your Blogger template:
Also on your template, place the loadCodePosts() function on the onload property of the BODY tag:
Finally, on your posts, just do something like this in order to include JavaScript code:
That's it... Simple and easy ^_^
Check this for learning how to place Google maps on Blogger posts.
<script type="text/javascript">
function loadCodePosts() {
var c, i;
if (document.all)
c = document.all.tags('code');
else if (document.getElementsByTagName)
c = document.getElementsByTagName('code');
var junk = /^\s*\46lt;\133\133CDATA\133|]]\46gt;\s*$/g;
for( i=0; i < c.length; i++ ) {
try { eval( c[i].innerHTML.replace( junk, '' ) ); } catch (err) { };
}
}
</script>
Also on your template, place the loadCodePosts() function on the onload property of the BODY tag:
<body onload="loadCodePosts()">
Finally, on your posts, just do something like this in order to include JavaScript code:
<code style="display:none"> Your JavaScript code! </code>
That's it... Simple and easy ^_^
Check this for learning how to place Google maps on Blogger posts.