AlertBox-in-Blog

Add a Alert box in Your Blog with a confirmation button.


      If you wanna to announce a new feature in your blog.What will you do for ?Most of us Make the feature at the top of our blog.But,don't you ever think of a alertbox that alert them about our new feature ?If you don't ,Now the time arrives , 
You can have a serious message for sites with adult contents or light message for fun :-

Alert Message and Dialog Box


This post will show you to how to add alert box to your Blog.
Now follow me :
Steps : 

  • Go To Template 
  • Page Elements
  • Add a Page Element in your left sidebar or post body area, and select HTML/JavaScript.

 Paste the code shown below:-
    <script type="text/javascript">
alert('I FOUND NEW HACKING SOFTWARE')
</script>
<noscript>Enable javascript in your browser to view an important message.</noscript>

To insert the alert dialog 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. Paste the code shown below:-

<script type="text/javascript">
confirm('This site contains explicit contents. Are you sure you want to continue?');
if (confirm('This site contains explicit contents. Are you sure you want to continue?')) {
window.location = "http://Blogxool.blogspot.Com/";
}
else {
window.location = "http://www.google.com/";
}
</script>


Your message appears in the red portion. Enter your Blog URL in the bluecolored part of the code. This is where your visitors will go to if they click “OK”. In the orange part, enter the URL of the place to redirect your visitors to should they click “Cancel”.

Alert Box with Prompt field

Another type of dialog box prompts the user to enter some information. For instance, the prompt box can ask the reader for his name and use that to customize the web page. Be reminded that many browsers are configured to disable scripts that ask for information. Have fun customizing your Blog but don't make this a key aspect of the contents. For example, if you have a story that keeps mentioning the name of the reader, the parts where the name should be will appear “null”.

In Template -> Page Elements -> Add a Page Element we add a HTML/JavaScript and paste the following code:-

<script type="text/javascript">
var yourName = prompt("How can we address you?", "Reader");
</script>


The question can be changed. The user will be prompted to enter something in the dialog box. He can of course leave it blank and press “OK” or click “Cancel”.

Alert Message and Dialog Box

Below this JavaScript, in your main body, add another HTML/JavaScript page element. This time, you can type in this:-

Welcome back <script type="text/javascript">document.write(yourName)</script>! Feel free to look around. If you like what you read, mention us in your post or link to this site. Hope to see you again <script type="text/javascript">document.write(yourName)</script>


This is what will appear in your Blog, based on the input that the reader keys in.

Alert Message and Dialog Box

Change the wordings to suit you and wherever you want the reader's name mentioned, add the script (shown in red). Try to phrase the wordings such that if the user enters nothing and clicks “OK”, the blank space is not obvious. A prompt dialog box like this adds a personal touch to your Blog.