Focused

Go Back   Focused > Design and Development > Web Development > Programming

» Sponsors

Register Now for FREE!
Our records show you have not yet registered to our forums. To sign up for your FREE account INSTANTLY fill out the form below!

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
 
Random Question
  I agree to forum rules 

Why doesn't this code work?

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 18-01-2007, 09:04 AM
New user
 
Join Date: Jul 2006
Age: 15
Posts: 5
Rep Power: 0
SonOfLathawar is on a distinguished road
Why doesn't this code work?

Quote:
<HTML>
<head>
<title>
Experiment
</title>
</head>
<body>
<script type="text/javascript" src="http://images.freewebs.com/JS/gc.js"></script>
<script type="text/javascript">
<!--
google_ad_client = "pub-4763110844767107";
google_alternate_ad_url = "http://jupiter.bravenet.com/rover/f?cid=freewebs&ctype=0&term=004&js=false";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="5819426830";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
<style>
.drop { position: absolute; width: 3; filter: flipV(), flipH(); font-size: 40; color: blue }
</style>
<script language="javascript">
snow = false; // false-rain; true-snow
snowsym = " * " //These are the symbols for each
rainsym = " ' " //You can put images here.
howmany = 10 //How many drops/snowflakes?
if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}
else{sym = rainsym; speed=30; drops=howmany; angle=6}
movex = -speed/angle; movey = speed; count = 0;
function moverain(){
for(move = 0; move < drops; move++){
xx[move]+=movex; yy[move]+=mv[move];
hmm = Math.round(Math.random()*1);
if(xx[move] < 0){xx[move] = maxx+10;}
if(yy[move] > maxy){yy[move] = 10;}
drop[move].left = xx[move]
drop[move].top = yy[move]+document.body.scrollTop;
}setTimeout('moverain()','1')}
</script>
<script language="javascript">
if (document.all){
drop = new Array(); xx = new Array(); yy = new Array(); mv = new Array()
ly = "document.all[\'"; st = "\'].style"
for(make = 0; make < drops; make++){
document.write('<div id="drop'+make+'" class=drop>'+sym+'</div>');
drop[make] = eval(ly+'drop'+make+st);
maxx = document.body.clientWidth-40
maxy = document.body.clientHeight-40
xx[make] = Math.random()*maxx;
yy[make] = -100-Math.random()*maxy;
drop[make].left = xx[make]
drop[make].top = yy[make]
mv[make] = (Math.random()*5)+speed/4;
drop[make].fontSize = (Math.random()*10)+20;
if(snow){col = 'white'}else{col = 'blue'}//if(snow) {col = 'white'} else {'YOUR COLOR'}
drop[make].color = col;
}
window.onload=moverain
}
</script>
<SCRIPT language=JavaScript>
dCol='#FF0000';//date colour.
fCol='#0000FF';//face colour.
sCol='#FFFF00';//seconds colour.
mCol='#FF0000';//minutes colour.
hCol='#00FF00';//hours colour.
ClockHeight=50;
ClockWidth=50;
ClockFromMouseY=0;
ClockFromMouseX=100;

d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THU RSDAY","FRIDAY","SATURDAY");
m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY"," JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEM BER","DECEMBER");
date=new Date();
day=date.getDate();
year=date.getYear();
if (year < 2000) year=year+1900;
TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;
D=TodaysDate.split('');
clockH='...';
clockH=clockH.split('');
M='....';
M=M.split('');
S='.....';
S=S.split('');
Face='1 2 3 4 5 6 7 8 9 10 11 12';
font='Arial';
size=1;
speed=0.6;
ns=(document.layers);
ie=!ns;
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/4.5
HandWidth=ClockWidth/4.5
HandY=-7;
HandX=-2.5;
scrll=0;
if (ie && !(document.all)){
step=0.09;
} else {
step=0.06;
}

currStep=0;
clocky=new Array();clockx=new Array();clockY=new Array();clockX=new Array();
for (i=0; i < n; i++){clocky[i]=0;clockx[i]=0;clockY[i]=0;clockX[i]=0}
clockDy=new Array();clockDx=new Array();clockDY=new Array();clockDX=new Array();
for (i=0; i < D.length; i++){clockDy[i]=0;clockDx[i]=0;clockDY[i]=0;clockDX[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 < clockH.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>'+clockH[i]+'</b></center></font></layer>');
}
if (ie){
document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < D.length; i++)
document.write('<div id="ieDate'+i+'" style="position:absolute;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:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < n; i++)
document.write('<div id="ieFace' + i + '" style="position:absolute;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:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < clockH.length; i++)
document.write('<div id="ieHours' + i + '" style="position:absolute;width:16px;height:16px;fo nt-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold">'+clockH[i]+'</div>');
document.write('</div></div>');
document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < M.length; i++)
document.write('<div id="ieMinutes'+i+'" style="position:absolute;width:16px;height:16px;fo nt-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:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < S.length; i++)
document.write('<div id="ieSeconds'+i+'" style="position:absolute;width:16px;height:16px;fo nt-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 = (!document.all)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (!document.all)?evnt.pageX+ClockFromMouseX:event.x +ClockFromMouseX;
}
(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){
document.getElementById("Od").style.top=window.doc ument.body.scrollTop;
document.getElementById("Of").style.top=window.doc ument.body.scrollTop;
document.getElementById("Oh").style.top=window.doc ument.body.scrollTop;
document.getElementById("Om").style.top=window.doc ument.body.scrollTop;
document.getElementById("Os").style.top=window.doc ument.body.scrollTop;
}
for (i=0; i < n; i++){
var F=(ns)?document.layers['nsFace'+i]:document.getElementById("ieFace" + i ).style;
F.top=clocky[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;
F.left=clockx[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);
}
for (i=0; i < clockH.length; i++){
var HL=(ns)?document.layers['nsHours'+i]:document.getElementById("ieHours"+i).style;
HL.top=clocky[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;
HL.left=clockx[i]+HandX+(i*HandWidth)*Math.cos(hrs);
}
for (i=0; i < M.length; i++){
var ML=(ns)?document.layers['nsMinutes'+i]:document.getElementById("ieMinutes"+i).style;
ML.top=clocky[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;
ML.left=clockx[i]+HandX+(i*HandWidth)*Math.cos(min);
}
for (i=0; i < S.length; i++){
var SL=(ns)?document.layers['nsSeconds'+i]:document.getElementById("ieSeconds" + i).style;
SL.top=clocky[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;
SL.left=clockx[i]+HandX+(i*HandWidth)*Math.cos(sec);
}
for (i=0; i < D.length; i++){
var DL=(ns)?document.layers['nsDate'+i]:document.getElementById("ieDate" + i).style;
DL.top=clockDy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;
DL.left=clockDx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);
}
currStep-=step;
}
function Delay(){
scrll=(ns)?window.pageYOffset:0;
clockDy[0]=Math.round(clockDY[0]+=((ymouse)-clockDY[0])*speed);
clockDx[0]=Math.round(clockDX[0]+=((xmouse)-clockDX[0])*speed);
for (i=1; i < D.length; i++){
clockDy[i]=Math.round(clockDY[i]+=(clockDy[i-1]-clockDY[i])*speed);
clockDx[i]=Math.round(clockDX[i]+=(clockDx[i-1]-clockDX[i])*speed);
}
clocky[0]=Math.round(clockY[0]+=((ymouse)-clockY[0])*speed);
clockx[0]=Math.round(clockX[0]+=((xmouse)-clockX[0])*speed);
for (i=1; i < n; i++){
clocky[i]=Math.round(clockY[i]+=(clocky[i-1]-clockY[i])*speed);
clockx[i]=Math.round(clockX[i]+=(clockx[i-1]-clockX[i])*speed);
}
ClockAndAssign();
setTimeout('Delay()',20);
}

if (ns||ie) {
Delay();
}
</SCRIPT>
</body>
</HTML>
I'm having a hard time with the cursor thing. How is it properly done?
And that cool clock-around-cursor thing? How is it done? There should be code for both in there, and also I'm having problems with the different design scrollbar & hit counter. Please help me with this code!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old NOW
Focused
 
Sponsors
 


__________________

 

  #2  
Old 05-05-2007, 05:24 PM
Sohan's Avatar
Administrator
 
Join Date: Jul 2006
Location: Leicester, UK
Posts: 530
Blog Entries: 18
Rep Power: 13
Sohan is on a distinguished road
Send a message via MSN to Sohan Send a message via Skype™ to Sohan

I'll try and get some one who might be able to help. JS is not my strong point.
__________________
Make a free blog with focused!
Arcade167 - The free arcade!
Leicester Personal Trainers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT. The time now is 06:03 AM.
©2006, Focused.ORG. All Rights Reserved.
Search Engine Friendly URLs by vBSEO 3.2.0