What is this?

Javascript can do many things, but the kind I have explained below is mostly pop-ups. When using javascript, be sure not to delete any single or double quotes, and when typing messages to be displayed on pop-ups, no single or double quotes may be used.

Enter Pop-up | Leaving Pop-up | Enter and Leaving Pop-up | Name-Asking Pop-up
Block Right Click/View Source Pop-up | Pop-up With Cancel Button
No Right Click Warning Pop-up | Password Pop-up | Pop-up Menu Window
Links Flash Different Colors | Graphics Float Around the Screen

Enter Pop-up:
The enter pop-up script is placed between the head tags. You can do as many of these as you want on any page. They will pop-up in the order you have them in the script.
<script language="JavaScript">alert("TEXT") </script>
Example

Leaving Pop-up:
The leaving pop-up script is placed in the body tag. The leaving pop-up appears when the viewer leaves the page. For the example, click on the link, then click on the link to come back to see how it works.
<body onUnload="alert('TEXT HERE');">
Example

Enter and Leaving Pop-up:
The enter and leaving pop-up script is placed in the body tag.
<body onLoad="alert('ENTER TEXT');" onUnload="alert('LEAVING TEXT');">
Example

Name-asking Pop-up:
The name-asking pop-up script is placed after the body tag. The welcome to my site can be changed to anything you wish, as well as the question whats your name.
Welcome to my site,
<script language="VBScript">
<!-- Dim Name
Name=InputBox("Whats your name?")
document.write Name -->
</script>
Example

Block Right Click/View Source Pop-up:
This script goes between the head tags and prevents viewers from viewing your source code. To see how this works, go to the example site and right click.
<script language="JavaScript"><!--
function click(){if (event.button==2){alert('dont
copy
')}}document.onmousedown=click// -->
</script>
Example

Pop-up With Cancel Button:
This script goes between the head tags and allows viewers to go back to the site they were just at instead of viewing your site if they press cancel.
<script language="JavaScript"> confirm("TEXT HERE")</script>
Example

Right Click Warning:
This script goes between the head tags. This simply warns the viewer the first time they right click and then keeps the pop-up there the second time they click. Watch out for this one, if you click a second time you might just end up using control-alt-delete to get out of it! It won't let you do anything!
<script LANGUAGE="JavaScript">
document.onmousedown=click
var times=0
var times2=10
function click() {
if ((event.button==2) || (event.button==3)) {
if (times>=1) { bye() }
alert("WARNING Text Here");
times++ } }
function bye() {
alert("SECOND TIME TEXT");
bye() }
</script>
Example

Password Pop-up:
This script goes between the head tags and requires a correct case sensitive password from anyone who tries to enter your page. This is by far the easiest method of password protection available.
<SCRIPT language="JavaScript">
<!--hide var password;var
pass1="PASSWORD GOES HERE";
password=prompt('TEXT ON P-UP',' ')
;if (password==pass1)
alert('TEXT IF CORRECT');
else {
window.location="URL OF PAGE THAT IT
GOES TO IF THEY ANSWERED WRONG
";
}//--></SCRIPT>
Example (the password is Example)

Pop-up Menu Window:
This script has two parts. The first goes between the head tags the second goes in the body tags. It puts a link on the page that when clicked on will pop-up with a page (that must be separately made) when a menu on it, or anything else for that matter.
<html>
<head>
<script LANGUAGE="JavaScript">
<!--
function WindowOpen1()
{
window.open('URL OF SITE HERE', 'Window1',
'resizable,scrollbars=yes,height=300,width=400');
}//--></script>
</head><body>
<a href="#" ONCLICK="WindowOpen1();return false">
TEXT OF LINK GOES HERE</a>
Example

Links Flash Different Colors:
This script goes between the head tags and cause the links on the page to constantly change colors. Beware: this can get really annoying.

Example

Graphics Float Around the Screen:
This script goes between the head tags and causes a graphic or graphics to float randomly around the screen. Beware: can become annoying after a while. You can change the url of the graphic, and the speed right above it, but nothing else.

Example