JAVA SCRIPTS
(for use by Superland Affiliates)

 

Welcome to SUPERLAND's Javascript Examples Page. Below are nine examples of common JavaScript. 
Of course there are other methods out there, this page is setup to help webmasters who have not had any 
or little experience with JavaScript. Use the menu below, or scroll down the page.

Exit Console | Blur Console | Pop Ups | Mouseover Text | WebTV Detection
Status Bar Text | Entrance Warning | Easy Navigation | Meta Refresh

COMMON EXIT CONSOLE:

Copy and Paste the following within the <HEAD> </HEAD> sections in your HTML document:

NOTE: You will have to edit the domain and page to work with your web site.

<!------ BEGIN CONSOLE CODE ------->
<SCRIPT language=Javascript>
<!--
var exit=true;
function exitcnsl()
{
if (exit)
open("http://www.yourdomain.com/pagename.html","new_window","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0, width=800,height=600,top=0,left=0");
}
//-->
</SCRIPT>
<!------ END CONSOLE CODE ------->

Next, Copy and Paste this next line at the end of your <BODY> tag:

onUnload="exitcnsl()"

Example:
<BODY BGCOLOR=#000000 onUnload="exitcnsl()">

You can experiment with the different settings, such as scrollbars=1, location=1, menubar=1, resizable=1, height/width, etc. 
Customize the code to work with your needs.

If you ONLY want the console to pop when the surfer leaves your site and you have multiple pages, 
you have two options:
 
1)Place your site within frames and use Target="_parent" on every link that 
leaves your site and needs to break the frames.
2)Place the console code in every page of your site, 
and add this to each <A HREF> statement that you do not wish the console to pop when clicked:

onClick="exit=false"

A correct link using the above code would look like this:
<A HREF="home.html" onClick="exit=false">

This will allow your visitor to navigate between the pages of your site without getting consoles every time 
they visit a new page. If you choose to place your site within frames (recommended), and do not want a 
console to pop when a surfer clicks on a
Superland banner, AND you want to break the frames, the link code
 would look like this:

<A HREF="home.html" Target="_parent" onClick="exit=false">

As long as the surfer does NOT break the frames, the console will not pop up. The console will only pop up 
when using frames, when the frames are broken. The console will not pop if you open a link into a new window.

TOP

BLUR ENTRY CONSOLE:

The "Blur" method will pop a console on the loading of a web page instead of when the web page is unloaded or exited. 
This is a great way to ensure that the console is viewed by the surfer. It actually loads behind the web page it is 
called from. Visit any one of
Superland's tours to see an example.

Copy and Paste the following in the <HEAD> </HEAD> sections in your HTML document:

NOTE: You will have to edit the domain and page to work with your web site.

<SCRIPT language="JavaScript">
<!--
myWindow=window.open('http://www.yourdomain.com/blurconsole.html','windowName');
self.focus();
if (!myWindow.opener) myWindow.opener = self;
// -->
</SCRIPT>

On the actual blur console, place this within the <HEAD> </HEAD> sections:

<SCRIPT language=javascript>
self.blur();
</script>

All Superland tours use the "Blur" method. Visit any one of our tours and view the source of "index.shtml" 
to see how easy this is to implement.

TOP

MANUAL POP UP WINDOWS:

To pop up a pre-sized window when clicking on a link, you can use this code. A use for this would 
be to have the need of a small window with information, examples, etc, and you don't want the surfer 
to leave the current page to view it, or you don't want to open a complete new browser window.

Here's an example:
Example

Copy and Paste the following within the <HEAD> </HEAD> sections in your HTML document:

<SCRIPT language="JavaScript">
<!--

function popup(url){
  cuteLittleWindow = window.open(url, "littleWindow", "location=no,width=480,height=250,scrollbars=no");
}

//-->
</SCRIPT>

The link that calls the pop up window looks like this:
<a href=javascript:popup('example.html')>Example</A>

The link inside of example.html that allows the user to close the popup with the link looks like this:
<A HREF="#" onclick="self.close()">Close Window</A>

TOP

WEB ABSTRACTION POP UNDER WINDOWS:

 

</head>
<script>

//Pop-under window- By Website Abstraction
//Credit notice must stay intact for use
//Visit http://adutopia.com for this script

//specify page to pop-under
var popunder="http://adutopia.com/travel.htm"

//Pop-under only once per browser session? (0=no, 1=yes)
//Specifying 0 will cause popunder to load every time page is loaded
var once_per_session=1

///No editing beyond here required/////

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie="popunder=yes"
}
}

function loadpopunder(){
win2=window.open(popunder)
win2.blur()
window.focus()
}

if (once_per_session==0)
loadpopunder()
else
loadornot()

</script>

<body style="text-align: center">

ONMOUSEOVER STATUS TEXT:

To disguise or hide the true location of a link in the status bar, you can use simple Javascript to achieve this.

The first link below is a normal link not using the "onmouseover" variable:

CLICK HERE FOR PORN

When the surfer mouse his mouse cursor over the link, he/she see's the true link in the browser's status bar. The next link uses the "onmousover" variable within the link code to hide the actuall link:

CLICK HERE FOR PORN

Both the examples above have the same exact link, but the bottom example hides this. If you click and hold down the mouse button on the second link, you can see the true destination.

Here's how it is done:

1)The link:

<a href="http://store.superstarvideo.com/index.cfm?apcode=YOURCODENUMBER">

2)The "onmouseover" code:
onmouseover="window.status='http://www.
superstarvideo.com'; return true;" onmouseout="window.status=''; return true;"

3)The link and "onmouseover" code combined:

<a href="http://store.superstarvideo.com/index.cfm?apcode=YOURCODENUMBER
" onmouseover="window.status='http://superstarvideo.com';  return true;" onmouseout="window.status='';  return true;">CLICK HERE FOR PORN</A>

TOP

WEBTV DETECTION SCRIPT:

If you're concerned with filtering WebTV traffic and want to be sure that your WebTV surfers are able to move through your site, you can redirect them to a "WebTV Friendly" version of your site. WebTV has allot of compatibility problems with Javascript. It does NOT work with the "onmouseover" variable and various other Javascript. If you have a WebTV surfer find your site and you have the "onmouseover" variable in your links, they will not be able to click on them. If you are concerned with this, put the following code at the entrance of your site (within the <HEAD> </HEAD> sections):

<SCRIPT LANGUAGE="JavaScript">
<!--
var userAgent=navigator.appName + " " + navigator.appVersion;
var agentInfo=userAgent.substring(0, 5);
if(agentInfo == "WebTV") {
//WebTV detected.
document.write('<META HTTP-EQUIV="Refresh" CONTENT="0; URL=webtvpage.html">');
document.write('</HEAD>');
document.write('<BODY BGCOLOR=#000000 TEXT=#da887b LINK=#da887b VLINK=#da887b><CENTER><p><br><p><br>');
document.write('<h1><b><a href="webtvpage.html">WebTV Users Please Click Here</a></h1>');
document.write('<BR><BR></BODY></HTML>');
}
//-->
</SCRIPT>

If you have a large site, this could be time consuming to create two complete versions, one for normal
browsers, and one for WebTV. If your site is small, or if you want to just create a small gallery for
WebTV users, it's a simple project.

TOP

STATUS BAR TEXT

When your page loads, a good way to help people remember something is to put a message in the
status bar when the page loads. To do this, just copy and paste the following code into your <BODY> Tag.

ONLOAD="window.defaultStatus='PUT YOUR MESSAGE HERE'"

And this tag within your body tag, should look like this:
<BODY ONLOAD="window.defaultStatus='PUT YOUR MESSAGE HERE'">

Click HERE for an example of what this looks like.

NOTE:When combining several "ONLOAD" functions within the same page, you can only use the command
"ONLOAD" once. If you have a <BODY> tag that is using an exit console and status bar text, you simply
separate the functions with a semicolon and a space.

TOP

ENTRANCE WARNING

This short script allows you to ask the surfer a question. This example is used to ask the surfer if he/she is
18 years or older, and allowed to view pornographic material. The page will successfully load if the user agrees
or clicks "OK". If the user does not agree or clicks "Cancel", it will not load the page and will bring them back
where they came from.

Place this code within the <HEAD> </HEAD> sections of your HTML document:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var agree=confirm("This web page contains adult material, are you 18 years or older and allowed to view pornographic material?");
if (agree)
document.write("");
else
history.go(-1);
// End -->
</SCRIPT>

Here's an example of this code in use:
Warning Example

TOP

EASY NAVIGATION

This example uses the backward and forward browser history. These are easy "Back" and "Forward" buttons
that you can place on any page for easy navigation. The nice thing about using this type of simple navigation
is that if you change the layout of your site, you won't have to edit these buttons.

Here is an example:

 

NOTE: The forward button will not work unless there is a page in your browsers history to go "Forward" to.

Here's the code:

<FORM>
<INPUT TYPE="button" VALUE="  BACK  " onClick="history.go(-1)">
<INPUT TYPE="button" VALUE="FORWARD" onCLick="history.go(1)">
</FORM>

It does not matter where you place the code in your document. Place the code wherever you would like the navigation buttons.

TOP

META REFRESH

Everyone has had the need at one point or another to have a page redirected to another location. The reasons for this are for different things. You could have moved a page to another server, you are using "Flash" and have a detection scheme to forward people that do not have the plugin installed, and many other reasons.

Here is the code that is to be placed withing the <HEAD> </HEAD> tags at the beginning of your HTML document:

<META HTTP-EQUIV="REFRESH" CONTENT="5; URL=javascript.html">

Click HERE for an example of how this works.

TOP

 

Exit Console | Blur Console | Pop Ups | Mouseover Text | WebTV Detection
Status Bar Text | Entrance Warning | Easy Navigation | Meta Refresh
468x60 BANNERS 1 2 3 ODD SIZE BANNERS 1 2 LOGOS | CONSOLES GAY | HELP
HANDY GRAPHICS LINKING CODES
for SUPERLAND Adult Video & Toy Stores
 WEBTOOLS
HANDY SCRIPTS

SE TOP PLACEMENT

Want to open more stores?  .... CLICK HERE