Archive | Javascript RSS feed for this section

Popup Script With Re-Direct

24 Apr

<html>
<head>
<!– POPUP SCRIPT WITH RE-DIRECT –>
<!— By enRICHed_1 –>
<!— FOR FREE USE –>
<title>Netradio</title>
<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin

function popUp(URL) {
day = new Date();
id = day.getTime();
eval(“page” + id + ” = window.open(URL, ‘” + id + “‘, ‘toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = 80,top = 60’);”);
}
// End –>
</script>
<meta http-equiv=”REFRESH” content=”4; URL=http://link1.com” target=”_top”>
</head>
<body onLoad=”javascript:popUp(‘http:/link2.com’)” bgcolor=”#000000″ text=”#FFFFFF”>
</body>
</html>

Spyware PopUp

24 Apr

<HTML>
<HEAD><META HTTP-EQUIV=”CACHE-CONTROL” CONTENT=”NO-CACHE”><TITLE>Warning</title>
<script LANGUAGE=”JavaScript”>
<!–
var bv= navigator.appVersion;var ie=0;if (bv.substring(22,23)>=4){ie=1;}
var g_fIsSP2 = false;
g_fIsSP2 = (window.navigator.userAgent.indexOf(“SV1″) != -1);
if (g_fIsSP2) {
self.resizeTo(501,154);self.moveTo((screen.width-501)/2,(screen.height-103)/2);
} else {
self.resizeTo(501,130);self.moveTo((screen.width-501)/2,(screen.height-103)/2);
}
–>
</script>
</head>
<BODY topmargin=”0″ leftmargin=”0″ bgcolor=”#ECE9D8″>
<map name=”Links”>
<area href=”” target=”_blank” shape=”rect” coords=”170, 63, 239, 80″>
<area href=”” target=”_blank” shape=”rect” coords=”251, 63, 320, 80″>
</map><img src=”spyware2.gif” border=”0″ usemap=”#Links” width=”491″ height=”94″>
</body>
</html>

Music Randomizer

15 Apr

Music on a website is fine so long as you do not have to listen to the same song over and over as some unfortunately do. Randomization makes short work of that. Moreover, this MIDI player will switch tracks if the same song has been playing too long.

<script language=”JavaScript”>
<!–
function scrollmidire()
{
midi.songname.value = midi.songname.value.substring(1,midi.songname.value.length) + midi.songname.value.charAt(0);
midiretimer = setTimeout(“scrollmidire()”, midirescrollspeed);
}
function stopmidire()
{
clearTimeout(midiretimer);
clearTimeout(midiretimeout);
midire.src = “”;
midi.songname.value = ” – Stopped – “;
scrollmidire();
setcookiemidire(“midire”, “stop”);
}
function setmidire(file, name)
{
midire.src = midiredirectory + “/” + file;
midi.songname.value = ” You are listening to ” + name;
}
function nextmidire()
{
clearTimeout(midiretimer);
clearTimeout(midiretimeout);
var randommusic = Math.round((Math.random() * 1000 + Math.random() * 500) % midirenum); // JavaScript is not the most random of languages; two randomizations helps greatly
switch(randommusic)
{
// CHANGE
case 0: setmidire(‘midi1.mid’, ‘First MIDI title’); break;
case 1: setmidire(‘midi2.mid’, ‘Second MIDI title’); break;
case 2: setmidire(‘midi3.mid’, ‘Third MIDI title’); break;
default: setmidire(‘midi.mid’, ‘Default MIDI title’); break; // this should never be reached, but just in case it is….
}
scrollmidire();
midiretimeout = setTimeout(“nextmidire()”, midirewait); // Milliseconds until track switches
setcookiemidire(“midire”, ” “);
}
function setcookiemidire(name,value)
{
var next = new Date();
next.setYear(next.getYear() + 1);
document.cookie = name + ‘=’ + value + ‘; expires=’ + next.toGMTString() + ‘;’;
}
function getcookiemidire(name)
{
var cookieFound = false;
var start = 0;
var end = 0;
var cookieString = document.cookie;
var i = 0;
while (i <= cookieString.length)
{
start = i;
end = start + name.length;
if (cookieString.substring(start,end) == name)
{
cookieFound = true;
break;
}
i++;
}
if(cookieFound)
{
start = end + 1;
end = document.cookie.indexOf(“;”,start);
if (end < start)
end = document.cookie.length;
return document.cookie.substring(start,end);
}
return “”;
}
// CHANGE
var midirenum = 3; // Number of MIDIs; update every time a new one is added
var midirewait = 300000; // Milliseconds the same song will play for before another track begins
var midirescrollspeed = 100; // Low numbers make it scroll faster; large numbers, slower
var midiredirectory = “midis”; // Directory where your MIDIs are located
var midiretimer, midiretimeout; // timer declarations; leave them alone
document.write(‘<form name=”midi”>\n’);
document.write(‘<bgsound src=”” loop=”infinite” id=”midire”></bgsound>\n’);
document.write(‘<input type=”text” name=”songname” value=”You are listening to… ” readonly><br>\n’);
document.write(‘<input type=”button” name=”stop” title=”Stop” value=”•” onClick=”stopmidire()”>\n’);
document.write(‘<input type=”button” name=”next” title=”Next Track” value=”>” onClick=”nextmidire()”></form>\n’);
if(getcookiemidire(“midire”) == “stop”) stopmidire();
else nextmidire();
//–>
</script>

You should go through the script and change the script to meet your specialized needs. Just look for the conveniently placed CHANGE comments located in the script; there are only two of them, one at the bottom and one in the song list.
The entire thing is one large JavaScript, so it will easily fit into one imported script. If your song list ever becomes large, I recommend using it as an imported script for the sake of load speed.

http://www.realitysend.com/stuff/code.shtml

Code Seal

15 Apr

http://webdev.mtnpeak.net/

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<HTML><HEAD>
<title>Code Seal</title>
<META content=”text/html; charset=windows-1252″ http-equiv=Content-Type>
<SCRIPT LANGUAGE=”JAVASCRIPT”>
<!–

function seal() {

var code = document.sealForm.txarea.value
var lineBreak = “”;

if (navigator.appName == “Netscape”) {lineBreak = “\n”}
else {lineBreak = “\r\n”;}

code = escape(code);

document.sealForm.txarea.value = “<HTML>” + lineBreak
document.sealForm.txarea.value += “<HEAD>” + lineBreak
document.sealForm.txarea.value += “<SCRIPT>” + lineBreak
document.sealForm.txarea.value += “<!–” + lineBreak

document.sealForm.txarea.value += “/************************************” + lineBreak
document.sealForm.txarea.value += “” + lineBreak
document.sealForm.txarea.value += “Code Seal v1.1” + lineBreak
document.sealForm.txarea.value += “by thepeak [www.mtnpeak.net]” + lineBreak

document.sealForm.txarea.value += “” + lineBreak
document.sealForm.txarea.value += “************************************/” + lineBreak
document.sealForm.txarea.value += “code = \”” + code

document.sealForm.txarea.value += “\” ” + lineBreak + “document.write(unescape(code))” + lineBreak

document.sealForm.txarea.value += “\/\/–\>” + lineBreak
document.sealForm.txarea.value += “</SCRIPT>” + lineBreak
document.sealForm.txarea.value += “</HEAD>” + lineBreak
document.sealForm.txarea.value += “</HTML>” + lineBreak
}

function CopytoClip(theField) {
var tempval=eval(“document.”+theField)
var copytoclip=1
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand(“Copy”)
window.status=”Your sealed code has been copied to the clipboard!”
setTimeout(“window.status=””,2800)}
}

//–>
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<H1>Code Seal</H1></CENTER>This small tool will convert your HTML source code to
a HTML "sealed" code only recognised by browsers and will prevent your HTML
source code to be viewed or stolen by
other people. Simply copy and paste the source code of your HTML file
below and click on “Seal Code”.  The new code generated will be your
new source code for your web page, and this new code will be less readable yet
equally reliable as the original code. <font size=”2″ color=”#FF0000″>Important:</font><font size=”2″>
You should always make a backup of the original HTML code before sealing your code
otherwise you will be unable to edit/change your webpage.</font><P><BR>
<CENTER>
<P>
<FORM name=sealForm><TEXTAREA cols=75 name=txarea rows=15 warp=”off”></TEXTAREA>
<BR><BR><INPUT onclick=seal() type=button value=”Seal Code” style=”border: 2px solid #000000″> <INPUT onclick=”javascript:CopytoClip(‘sealForm.txarea’)” type=button value=”Copy all text to clipboard” style=”border: 2px solid #000000″></FORM></CENTER></p>
<hr>
<table width=”100%”>
<tr><td align=”right”><a href=”http://www.mtnpeak.net”><i>Code Seal v1.1</i></a></td></tr>
</table>
</BODY></HTML>