Friday, April 30, 2010

Before we go any further to discuss this JavaScript - Small Tips II, I must remain you as in JavaScript I, that at least there are 2 think we must be consider to use the JavaScript apps , because to many JavaScript in your template will slowing down your web page to load. Besides that, for security reason, many user set their browser to disable JavaScripts. To resolve these problem, we must be wise to choose which the JavaScript that will be install into our template (choose the appropriate and useful JS apps) and use the "warning message" that we using JavaScript .



How To Make An Alert Message With JavaScript.



The functions of an alert message is to provide announcements, information or warning to the guests before they go to see or read the entire contents of our site.

There are a few display an alert message that we can create, an alert message box which only has a button 'OK', "OK" button and "cancel" to divert to other sites, and an alert message box with a dialog box.



Note: This tricks maybe annoying to some people, because this pop up box will STOP our browsing activity, we will not be able to do anything until we execute this pop up box (click OK or X).



An Alert Message Box With 'OK" Button.



We usually seen this message on "adult" or "serious" sites, the messages give warning to their visitor about the content of the sites and their restriction or limitation.

To create an alert message box, login to your account, go to Template -> Page Elements -> Add a Page Element in your left sidebar or post body area, and select HTML/JavaScript. And paste this code shown below.

<script type="text/javascript">
alert('You are about to enter our "serious" site. This site contains violence and sadistic material, persons under 18 years old are prohibited ... Beware!')
</script>
<noscript>Enable javascript in your browser to view an important message.</noscript>
Just change the Red words with your message..!, this words will be displayed as a pop up alert box when the visitors view your site / blog. The Purple words will show up when our guests disable their Javascript on their browser.

Look at this example below..





I put this "alert message" page element right under my header. This alert message box just for an information cause both choices, click "OK" button or click "X" will bring our visitor directly into our site (continuing to open our site).





An Alert Message Box With Confirmation ( "OK" and "Cancel" ) Button. 



For any reasons, sometimes we need to give our guests a choice not to continuing or cancel to visiting our website / blog. If our guests prefer to cancel, then they will be redirect into another URL address.

So if we want to do this trick, go to Template -> Page Elements -> Add a Page Element in your left sidebar or post body area or even below your header, and select HTML/JavaScript and Paste this code below.



<script type="text/javascript">

confirm('This site contains sadistic materials. Are you sure you want to continue?');

if (confirm('This site contains sadistic materials. Are you sure you want to continue?')) {

window.location = "http://doit2us.blogspot.com/";

}

else {

window.location = "http://www.google.com/";

}

</script>
Change the Red words with your message..!, the Blue URL is the URL destination address when our guests click the "OK" button, and the Purple URL is the URL destination address when our guests click the "cancel" button or click "X".

 





An Alert Message Box With Dialog Form



Besides give a warning or information to our guest, with this simple Javascript trick below, we can build a warning or information message + dialog form. In this example below, This trick is to give a warning to our guest, knowing the name, and give a welcome message. It,s a rather weird isn't it, but this just a sample, you can created better than this, I just want to share an Idea...



First Script

<script type="text/javascript">

alert('You are about to enter our "serious" site. This site contains violence and sadistic material, persons under 18 years old are prohibited ... Beware!')



var yourName = prompt("Please, write your name first...!", "Reader");

</script>



<noscript>Enable javascript in your browser to view an important message.</noscript>

<script type="text/javascript"></script>
The way what we done it, is the same with both  How To Make An Alert Message With JavaScript. above, I put the FirstScript page element below my header. Because this is a dialog box, of course we must have a follow up, to continuing the action, So I put a second script  in top of my post body as my welcome message.



Second Script

Thank you <script type="text/javascript">document.write(yourName)</script>! Feel free to look around. If you like what you read, please mention us in your post or link to this site. Enjoy your visit <script type="text/javascript">document.write(yourName)</script>
So this is what we got with those trick.

When first opened our site or blog, there will be a pop up box warning message just like the first trick,





after click "OK" or "X" button, there will be shown another pop up dialog box like this,





If the Guest write their name into the dialog box (eg. Mc4tur) and click "OK", then they will be brought to continuing opened our site with a welcome message in the place where we put the second script page element.



Well that's all, you can combined those tricks or make a modification (eg. put into the post). but please remember choose wisely because of the disadvantage of the JS tricks.

Friday, April 23, 2010

B efore we continuing discuss about How To Customize The Blogger Blog Post Footer, Let,s look at this picture bellow for the description...





1. Change The "AUTHOR" Text

Actually, this AUTHOR'S name is the name that shown on our blogger profile. To change this name then followed this steps.

Log in to Blogger, in Your Dashboard select your blog (if you have more then one) >> Layout >> Edit HTML and click Expand Widget Templates box. Then find this words data:post.author

<div class='post-footer'>

  

      <div class='post-footer-line post-footer-line-1'>

       <span class='post-author'>

          <b:if cond='data:top.showAuthor'>

            <data:top.authorLabel/> <data:post.author/>

          </b:if>

        </span>      

        <span class='post-timestamp'>

          <b:if cond='data:top.showTimestamp'>

            <data:top.timestampLabel/>

          <b:if cond='data:post.url'>

            <a class='timestamp-link' expr:href='data:post.url' title='permanent link'><data:post.timestamp/></a>

          </b:if>
A. To change your author's name, just replace the <data:post.author/> with whatever name you like.. This is mine when I change Mc4tur (before) with Admin.

Note: We can "decorate" our name with HTML code, I make it bold by adding Tex



B. To change the POSTED BY phrase, replace the <data:top.authorLabel/> with yours. This is mine when I change it into WRITTEN BY

 Note: We can decorate this with HTML Code too..





2. Change The "AUTHOR" Text With An Image

Because this tricks are about "knowing the posistion" of the AUTHOR, and we also know that we can "decorate" it with HTML Code. Instead of Text, we can replace it with our Image, or even combined them.



To do this tricks, of course we must have an Image (small signature will be better) first. Let's just say that we already have the image that we store in a host sever. Please remember the URL of your image.



Note: You can learn how to have free web storage in Using Google Groups and Google Sites as A Web Storage Space and how to use it in Create a Rainbow Colored Link



A. To change the Author text with your Image and blog link, just replace <data:top.authorLabel/> <data:post.author/> with this script.. 

<a href="Your Blog URL"><img src="Your Image URL" /></a>
If you don't want to insert your blog link, then just deleted it and only insert <img src="Your Image URL" /></a> Then the final script will be like this:

<div class='post-footer'>

  

      <div class='post-footer-line post-footer-line-1'>

       <span class='post-author'>

          <b:if cond='data:top.showAuthor'>

           
<a href="Your Blog URL"><img src="Your Image    URL" /></a> 

          </b:if>

        </span>      

        <span class='post-timestamp'>

          <b:if cond='data:top.showTimestamp'>

            <data:top.timestampLabel/>

          <b:if cond='data:post.url'>

            <a class='timestamp-link' expr:href='data:post.url' title='permanent link'><data:post.timestamp/></a>

          </b:if>


B. To combined with the text, choose which one will be replaced by the image. <data:top.authorLabel/> or <data:post.author/> . Usually we replace our name with Image. We can also combine with Text Replace (1B.)  either, to make WRITTEN BY "IMAGE NAME".

Monday, April 19, 2010

This trick is rather similar with How To Make A Spoiler In Second on purposed and the final display, Each technique have their "positive and negative" factor. I don't want to discuss the "more and less" of each trick, is up to you to decided which one that will fit to your purpose. Scrollbars will be very useful to minimized the text area and allowing readers to view the full contents by clicking the bar. We usually saw this technique implemented  for Terms of Service, User Agreements, Rules, or Privacy Policy.



To make a scrollbar within the blog post, first we must define a class (write into HTML Template), this action is giving the "name" to this class and setting the display when it show, and then to applied within the blog post, we must "call" the class (by writing the class in our blog post).



Log in to Blogger >> In your Dashboard choose your Lay out blog >> Edit HTML >> and Find /* Sidebar Content */ and put this script to define a class below it:

.scrollingpostbar {

height:350px;

width:450px;

border:0;

overflow:auto;

}
You can rename .scrollingpostbar as you like, as long as you remember the "name", set the height and weight and border by adjust 350, 450 and 0 to make it fit with your post.





After finished, then we can type the text, although the tittle is How To Make A Scroolbar Within Blog Post, actually we can use this scrollbar mode in the page element in our template, exactly the same as How To Make A Spoiler In Second .



To show up in our blog post, after we have typed the TEXTARTICLE in the Post Editor, then click “Edit HTML” and paste these tags, exactly as this position:

<div class="scrollingpostbar">TEXTARTICLE</div>
I wrote this article again and applied this trick to show up how is the final display for example:



This trick is rather similar with How To Make A Spoiler In Second on purposed and the final display, Each technique have their "positive and negative" factor. I don't want to discuss the "more and less" of each trick, is up to you to decided which one that will fit to your purpose. Scrollbars will be very useful to minimized the text area and allowing readers to view the full contents by clicking the bar. We usually saw this technique implemented  for Terms of Service, User Agreements, Rules, or Privacy Policy.



To make a scrollbar within the blog post, first we must define a class (write into HTML Template), this action is giving the "name" to this class and setting the display when it show, and then to applied within the blog post, we must "call" the class (by writing the class in our blog post).



Log in to Blogger >> In your Dashboard choose your Lay out blog >> Edit HTML >> and Find /* Sidebar Content */ and put this script to define a class below it:

.scrollingpostbar {

height:350px;

width:450px;

border:0;

overflow:auto;

}
You can rename .scrollingpostbar as you like, as long as you remember the "name", set the height and weight and border by adjust 350, 450 and 0 to make it fit with your post.





After finished, then we can type the text, although the tittle is How To Make A Scroolbar Within Blog Post, actually we can use this scrollbar mode in the page element in our template, exactly the same as How To Make A Spoiler In Second .



To show up in our blog post, after we have typed the TEXTARTICLE in the Post Editor, then click “Edit HTML” and paste these tags, exactly as this position:

<div class="scrollingpostbar">TEXTARTICLE</div>
To make a scrollbar in page element.  Our Text or HTML/Javascript Code can be inserted directly into the template via Layout -> Page Elements -> Add a Gadget >> Text or HTML/JavaScript. Similarly, if we have typed it in the rich editor mode, we can click the “Edit HTML” link at the top right corner and insert the above tags.



After publishing the post or saving the page element, you will be able to see the text or HTML/JavaScript gadget within a box and the scrollbars automatically inserted. 

Note : this trick only works on Text or HTML/JavaScript gadget.
 


Disclaimer:We does not host any of the templates available on this blog. This blog merely indexes other sites contents.