Top > Affiliate Marketing > pop-under code


Below you'll find a variety of pop-under scripts together with explanations of how the javascript code works.

Pop-under windows open underneath, or behind the front window. As pop-unders load in the background, visitors usually don't notice them until they close the front window. This gives the pop-under plenty of time to load, enabling you to put more content in the page.

The code for pop-under windows is not much different to that for regular pop-ups. In fact, it's identical except for a tiny addition which tells the browser the pop-under shouldn't be the front window.

In Javacript, if we give a window "focus" it is sent to the front. If we "blur" a window, it no longer has focus. We can use either focus or blur to create a pop-under window. We can give the main, or "trigger" window focus, thereby forcing the pop window behind it. Or we can directly blur the pop window itself, thus sending it to the back.

using the focus() method

Let's look at our second pop-up script example earlier. We could make a pop-under script from this by simply adding the window.focus() method (the new code is underlined):

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

function popup(){
window.open('URL/to/popup.html','PopupName','toolbar=0,
location=0,status=0,menubar=0,scrollbars=0,resizable=0,
width=345,height=400');
window.focus();
}

// end -->
</script>

The window.focus() instruction acts on the current window. Thus as soon as the pop window opens, the trigger window will push itself back to the front.

Note: This script and all the examples below are called using the onLoad="popup()" command inserted in the <BODY> tag

Another way we could achieve the same result is by adding:

onblur=self.focus()

To the <BODY> tag on the trigger page. What this does is basically tell the page "If you loose the front position (onblur), put yourself back in front (self.focus)." When the page regains focus, it therefore pushes the pop window behind it.

using the blur() method

To tell the pop window itself to blur, the JavaScript needs to be able to reference the new window. To do that we need to assign a variable (var) to it which we'll call "newWindow" like this:

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

function popup() {
var newWindow = window.open('URL/to/popup.html','PopupName',
'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,
resizable=0,width=345,height=400');
newWindow.blur();
}

// end -->
</script>

As you can see, the last line now calls the blur() method on the pop window with:

newWindow.blur();

A tidier way to do the same is to use the third pop-up example we gave. Since the variable "newWindow" is already defined in this script, all we need to do is add newWindow.blur() to the code:

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

function popup() {
var page = "URL/to/popup.html";
var windowprops = "width=380,height=500,location=no,menubar=no,
toolbar=no,scrollbars=no,resizable=no";
newWindow = window.open(page,'PopupName',windowprops);
newWindow.blur();
}

// end -->
</script>

To employ the blur() method with the cookie script you need to modify it by defining our "newWindow" variable like this:

function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
newWindow = window.open(page, "PopupName", windowprops);
newWindow.blur();



TrackBacks

Trackback's URL:
http://www.seikokaiun.com/mt3/mt-tb.cgi/4108

Post Comment

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)

Category


◆ビジネス系
ブログアフィリエイトで稼ぐ日給8万円
ブログアフィリエイトで世界一周旅行
はるちゃんのネットで得しちゃおう!
超時短!1日1万円ブログアフィリエイトで稼ぐ私 の方法
アフィリエイト情報 Rich Rich
実践!情報商材アフィリエイトで稼ぐ
+100 万円副業収入術
ブログアフィリエイトで愛でいっぱいのお金持ちに なる方法
副収入100 倍計画書
ネットで得とく副収入
小遣い倍増計画
ちょっぴりおこづかいカフェテリア
投資で自己実現
競馬投資術
株達人ドットコム
内職バイトで高収入!道楽庵
徹底比較 外為会社
本当にオートサーフ&HYIP で稼げるの?!
◆検索エンジン系
モーニングサーチ
総合検索エンジン・Discovery.Search! サーチエンジン
◆HP 製作系
ホームページ製作ドットコム
web デザイナーが作るフリーホームページ素材
ホームページ製作会社グリーンステップ
Add to Google Add to My Yahoo!
Discount sale now! 50 Things In Common Successful people