You can check the Blogger page type (index, item or archive) from JavaScript by adding this template code to the head section of your Blogger template:
<script type="text/javascript"> var blog_pageType = "<data:blog.pageType/>" ; </script>
You can then use the blog_pageType
variable in your JavaScript whether it is inside the template code or a blog post:
<script type="text/javascript"> switch ( blog_pageType ) { case "index": document.write( "<p>Main Page</p>" ); break; case "item": document.write( "<p>Blog Post</p>" ); break; case "archive": document.write( "<p>Archive Page</p>" ); break; } </script>
Simple, neat and effective.