This Is A Sample Of Sticky Post


The Problem is: to do this trick, we must use HTML code to make up the text... But don't worry, if you are not capable with HTML Codes, there are simple and fast way to make your sticky post without learn it. Use your "New Post" to make a sample of your sticky post, set the display as close as your real post, use the Preview to check your sticky post display then copy-paste into your content collumn text add gadget.

Learn how to make this sticky post in http://doit2us.blogspot.com/2010/02/how-to-make-sticky-post-in-your-blogger.html

Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Free Pop-Up Scripts - Pop-up Script To Open A Window When Your Page Loads I

>> Saturday, September 4, 2010

It's been a long time since I wrote my last post... So here I post some Pop-Up Script.

In this First Script I'll give some example that You can use it in Your Blog...

Pop-up Script To Open A Window When Your Page Loads 

 Just put the following script between Your <HEAD> and </HEAD> tag

<script language="javascript">
<!-- begin

function popup(Site)
{
window.open(Site,'PopupName','toolbar=no,statusbar=no,
location=no,scrollbars=yes,resizable=yes,width=275,height=200')
}

// end -->
</script>

Then add the following code into your <BODY> tag:

onLoad="popup('URL/to/popup.html')"

Your<BODY> tag should then look something like this:

<BODY bgcolor="#ffffff" text="#000000"
onLoad="popup('http://doit2us.blogspot.com/popup.html')">

Note: In this and all script examples that follow, change the attributes "toolbar", "statusbar", etc., to on (1) or off (0) as you prefer (or omit them), and set the width and height to the size you require.

That's all.. Happy Pop-Up...

JavaScript - Small Tips II (How To Make An Alert Message Pop Up Box)

>> 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.

JavaScript - Small Tips I

>> Friday, March 19, 2010

How To Make a JavaScript Externally

As I mentioned in How To Make Recent Comment II and How To Make a Related Posts Widgets in Blogger.. One of the problems with the JavaScript code in our template, is to make our web loading page  become slower relatively or even could not see if there is something wrong with Script Js itself or the browser used.

To overcome this problem, we can put this Script (JS) externally.
So when the visitors browse our Site or Blog, their browser will reading our template Script first and then Script external JS after.
With this method our visitors still can see our page with more faster, although maybe there is a problem with JavaScript or compatibility of Browser used. (This is why some site owner write "warning text" on their web page "This Site Will Look Perfect In X, Y and Z browser".)

To make an external JavaScript, the first step of course, we must have a server / web host to store our JS file. If you do not have and want to have a web storage for free please read "Using Google Group and Google Sites as Web Storage".

After we have a host sever then the next step is to make your script as a JS file. Just simply find your  JavaScript code, Cut it and Paste in your Notepad and save it as a JS file (.js), Store your JS file into your host server and put some "calling" code into your HTML template.

Please take look at How To Make a Blogger Related Post. cause I will use this article to make an explanation.

To make the Related Post JavaScript externally, Just Cut..! the Related Post JavaScript (the green code) and paste in your Notepad, then Save it as yourkodescript.js.  
Next ..Upload / store this file into your web host and remember the URL link.

Write this folowwing script exactly on the place where the Related Post JavaScript was before.     

<script src='http://Yourwebhost.com/yourkodescript.js' type='text/javascript'/>  
The final position will look like this,
]]></b:skin> 
The Display Setting Script
<script src='http://Yourwebhost.com/yourkodescript.js' type='text/javascript'/>
</head>
Note :  The rest of the step to make related post widget are still the same...


Inform About The Existence Of JavaScript In Our Template

Because afraid of there are malicious script contained in JavaScript files, especially external JavaScript. Many users decided to configured their browser to disable the script, so that the script will not be able to see/read, and this means that your visitor couldn't be able to view all of your JavaScript build widget.

To anticipated this situation, we can inform to our visitors about the existence of JavaScript in our template / widget and maybe giving an explanation or guarantee that there is no malicious script inside it or no harm or it's safe.

To do this, we can simply add a small script at the end of your JavaScript Code.
JavaScript
<noscript>You need to enable JavaScript to read this.</noscript>
Just like what I have done in How To Make Recent Comments. If the visitor disabled the JavaScripts browser, There will be warning text below my "recent comments title" that's says "You Need to enable JavaScript to read this"


You can edit the 'explanation text' as you want..  how about add "Guarantee 100% no harm"..!!

Please, Write your comments.. and maybe you want to share your secret JS tips..., will be nice...

 

  © New Blogger Tips For Us Free Blogger Template by Mc 2010.

Back to TOP