BillHung.Net


powered by FreeFind     sms

 

Document.write

prompt example  7 May 2006

<script type="text/javascript">
<!--function Info()
{
Name1=prompt("What is your name Enter a name in the box "+
"so you can see the effect on the page","Fido");
}
document.write("<h1>"+Name1+"\'s Special Page</h1>");
document.write("Welcome to my page ");
document.write(Name1+". ");
document.write("I have made everything just right for you.");
document.write("<p>So, "+Name1+", click <a href='index.html'>here</a> "+
"to learn how to get what you have been dreaming of for so long!<hr>");
//-->
</script>

 

Blinking Link 3 August 2004

<script language="JavaScript" src="others/gitme.js"></script>

gitme.js

/*************
**** <config>
**/
startColor = "#e8a317"; // MouseOut link color
endColor = "#FFFFFF"; // MouseOver link color

stepIn = 20; // delay when fading in
stepOut = 20; // delay when fading out

/*
** set to true or false; true will
** cause all links to fade automatically
***/
autoFade = true;
/*
** set to true or false; true will cause all CSS
** classes with "fade" in them to fade onmouseover
***/
sloppyClass = true;
/**
**** </config>
**************/
/*************
**** <install>
**
**
**** </install>
**************/

hexa = new makearray(16);
for(var i = 0; i < 10; i++)
hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";

document.onmouseover = domouseover;
document.onmouseout = domouseout;

startColor = dehexize(startColor.toLowerCase());
endColor = dehexize(endColor.toLowerCase());

var fadeId = new Array();
var timerID = 0;
var theElement,theTagName,theClassName,theUniqueID

function dehexize(Color){
var colorArr = new makearray(3);
for (i=1; i<7; i++){
for (j=0; j<16; j++){
if (Color.charAt(i) == hexa[j]){
if (i%2 !=0)
colorArr[Math.floor((i-1)/2)]=eval(j)*16;
else
colorArr[Math.floor((i-1)/2)]+=eval(j);
}
}
}
return colorArr;
}

function domouseover() {
if(document.all) {
clearTimeout(timerID);
theElement = event.srcElement;
theTagName = theElement.tagName;
theClassName = theElement.className;
theUniqueID = theElement.uniqueID;
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) {
//alert(theElement);
fade(startColor,endColor,theUniqueID,stepIn);
timerID = setTimeout('pulsedown()',500);
}
}
}

function pulseup() {
if(document.all) {
clearTimeout(timerID);
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) {
//alert(theElement);
fade(startColor,endColor,theUniqueID,stepIn);
timerID = setTimeout('pulsedown(theElement)',500);
}
}
}

function pulsedown(theElement) {
if (document.all) {
clearTimeout(timerID);
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) {
//alert(theElement);
fade(endColor,startColor,theUniqueID,stepOut);
timerID = setTimeout('pulseup()',500);
}
}
}


function domouseout() {
if (document.all) {
clearTimeout(timerID);
var srcElement = event.srcElement;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(endColor,startColor,srcElement.uniqueID,stepOut);
}
}

function makearray(n) {
this.length = n;
for(var i = 1; i <= n; i++)
this[i] = 0;
return this;
}

function hex(i) {
if (i < 0)
return "00";
else if (i > 255)
return "ff";
else
return "" + hexa[Math.floor(i/16)] + hexa[i%16];}

function setColor(r, g, b, element) {
var hr = hex(r); var hg = hex(g); var hb = hex(b);
element.style.color = "#"+hr+hg+hb;
}

function fade(s,e, element,step){
var sr = s[0]; var sg = s[1]; var sb = s[2];
var er = e[0]; var eg = e[1]; var eb = e[2];

if (fadeId[0] != null && fade[0] != element){
setColor(sr,sg,sb,eval(fadeId[0]));
var i = 1;
while(i < fadeId.length){
clearTimeout(fadeId[i]);
i++;
}
}

for(var i = 0; i <= step; i++) {
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step);
}
fadeId[0] = element;
}

Ascii Cursor Clock

<!-- Clock Cursor : Found at Blogring.net Modified by Bill Hung July 2004-->
<script language=JavaScript>
dCol='000000';//date colour.
fCol='000000';//face colour.
sCol='3300FF';//seconds colour.
mCol='000000';//minutes colour.
hCol='009900';//hours colour.
ClockHeight=35;
ClockWidth=35;
ClockFromMouseY=0;
ClockFromMouseX=100;

//Alter nothing below! Alignments will be lost!

BillSays =0;
inXY = 1;
xBoarder = window.document.body.scrollWidth - 50;
yBoarder = window.document.body.clientHeight -50;

d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");
m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");
date=new Date();
day=date.getDate();
year=date.getYear();
if (year < 2000) year=year+1900;
TodaysDate=" "+d[date.getDay()]+" "+m[date.getMonth()]+" "+day+" "+year;
D=TodaysDate.split('');
H='***';
H=H.split('');
M='*****';
M=M.split('');
S='Bear';
S=S.split('');
Face='1 2 3 4 5 6 7 8 9 10 11 12';
font='Arial';
size=1;
speed=0.6;
Dspeed=0.1;
ns=(document.layers);
ie=(document.all);
Face=Face.split(' ');
n=Face.length;
a=size*10;
ymouse=0;
xmouse=0;
scrll=0;
props="<font face="+font+" size="+size+" color="+fCol+"><B>";
props2="<font face="+font+" size="+size+" color="+dCol+"><B>";
Split=360/n;
Dsplit=360/D.length;
HandHeight=ClockHeight/3.3
HandWidth=ClockWidth/3.3
HandY=-7;
HandX=-2.5;
scrll=0;
step=0.06;
currStep=0;
y=new Array();x=new Array();Y=new Array();X=new Array();
for (i=0; i < n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0}
Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();
for (i=0; i < D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0}
if (ns){
for (i=0; i < D.length; i++)
document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D[i]+'</font></center></layer>');
for (i=0; i < n; i++)
document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face[i]+'</font></center></layer>');
for (i=0; i < S.length; i++)
document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></layer>');
for (i=0; i < M.length; i++)
document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M[i]+'</b></center></font></layer>');
for (i=0; i < H.length; i++)
document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H[i]+'</b></center></font></layer>');
}
if (ie){
document.write('<div id="Od" style="position:abs'+'olute;top:0px;left:0px"><div style="position:rela'+'tive">');
for (i=0; i < D.length; i++)
document.write('<div id="ieDate" style="position:abs'+'olute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props2+D[i]+'</B></font></div>');
document.write('</div></div>');
document.write('<div id="Of" style="position:abs'+'olute;top:0px;left:0px"><div style="position:rela'+'tive">');
for (i=0; i < n; i++)
document.write('<div id="ieFace" style="position:abs'+'olute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props+Face[i]+'</B></font></div>');
document.write('</div></div>');
document.write('<div id="Oh" style="position:abs'+'olute;top:0px;left:0px"><div style="position:rela'+'tive">');
for (i=0; i < H.length; i++)
document.write('<div id="ieHours" style="position:abs'+'olute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold">'+H[i]+'</div>');
document.write('</div></div>');
document.write('<div id="Om" style="position:abs'+'olute;top:0px;left:0px"><div style="position:rela'+'tive">');
for (i=0; i < M.length; i++)
document.write('<div id="ieMinutes" style="position:abs'+'olute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold">'+M[i]+'</div>');
document.write('</div></div>')
document.write('<div id="Os" style="position:abs'+'olute;top:0px;left:0px"><div style="position:rela'+'tive">');
for (i=0; i < S.length; i++)
document.write('<div id="ieSeconds" style="position:abs'+'olute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold">'+S[i]+'</div>');
document.write('</div></div>')
}
(ns)?window.captureEvents(Event.MOUSEMOVE):0;
function Mouse(evnt)
{
ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;

if (ymouse>yBoarder && xmouse>xBoarder)
{
if (inXY == 1)
{
if (BillSays ==0)
BillSays = 1;
else
BillSays =0;
inXY = 0;
}

}
else
{
inXY =1;
}

if ( BillSays ==1)
{
ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;
}
else
{
ymouse=50;
xmouse = xBoarder;
}


}
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
function ClockAndAssign(){
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;
if (ie && BillSays){
Od.style.top=window.document.body.scrollTop;
Of.style.top=window.document.body.scrollTop;
Oh.style.top=window.document.body.scrollTop;
Om.style.top=window.document.body.scrollTop;
Os.style.top=window.document.body.scrollTop;
}
for (i=0; i < n; i++){
var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style;
F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;
F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);
}
for (i=0; i < H.length; i++){
var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style;
HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;
HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs);
}
for (i=0; i < M.length; i++){
var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style;
ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;
ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min);
}
for (i=0; i < S.length; i++){
var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style;
SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;
SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec);
}
for (i=0; i < D.length; i++){
var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style;
DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;
DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);
}
currStep-=step;
}
function Delay(){
scrll=(ns)?window.pageYOffset:0;
Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*Dspeed);
Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*Dspeed);
for (i=1; i < D.length; i++){
Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*Dspeed);
Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*Dspeed);
}
y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);
x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);
for (i=1; i < n; i++){
y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed);
x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed);
}
ClockAndAssign();
setTimeout('Delay()',20);
}
if (ns||ie)window.onload=Delay;
</script>
<!--END Clock Cursor : Found at Blogring.net Modified by Bill Hung July 2004-->