Jump to content
xisto Community
Microsoft

Javascripts

Recommended Posts

im gonna gives some codes....

This code will make a blue ball where u click it and falls down, and bounces
 



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="TextPad 4.4">
<LINK href="general.css" rel="stylesheet" type="text/css">
<script LANGUAGE="JavaScript1.2">
<!-- Original: �Dragos Saracu (smardoi@yahoo.com) -->
<!-- Cross Browser by: �Bob Simpson (webmaster@maryjanebrown.net) -->
<!-- Contributor URL: �maryjanebrown.net/webmaster/ �-->
<!-- Begin
function BrowserCheck() {
var b = navigator.appName;
if (b == "Netscape") this.b = "NS";
else if (b == "Microsoft Internet Explorer") this.b = "IE";
else this.b = b;
this.v = parseInt(navigator.appVersion);
this.NS = (this.b == "NS" && this.v>=4);
this.NS4 = (this.b == "NS" && this.v == 4);
this.NS5 = (this.b == "NS" && this.v == 5);
this.IE = (this.b == "IE" && this.v>=4);
this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0);
this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0);
if (this.IE5 || this.NS5) this.VER5 = true;
if (this.IE4 || this.NS4) this.VER4 = true;
this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
this.min = (this.NS||this.IE);
}
is = new BrowserCheck();
// �End -->
</script>

</HEAD>

<BODY Background=../graphics/grayback.jpg>
<center><BR><BR><BR>
Click anywhere to start script<br>
<div id="staticBall" style="position:relative;visibility:visible">
<img src="ball.gif" height=30 width=30 alt="Static ball">
</div>
</center>
<div id="ball" style="visibility:hidden; position:absolute; left:100; top:10; height:34; width:34">
<img src="ball.gif" height=30 width=30 alt="Bouncing ball">
</div>

<script language="Javascript1.2">
<!-- Begin
iter = 0;
setId = 0;
down = true;
up = false;
bouncingBall = (is.VER5) ? document.getElementById("ball").style
: (is.NS) ? document.layers["ball"]
: document.all["ball"].style;
stillBall = (is.VER5) ? document.getElementById("staticBall").style
: (is.NS) ? document.layers["staticBall"] : document.all["staticBall"].style;
winH = (is.NS) ? window.innerHeight - 55 : document.body.offsetHeight - 55;
document.onmouseup = buttonUp;
if (is.NS4)
document.captureEvents(Event.MOUSEUP);
function buttonUp(e) {
if ( ((is.NS) ? e.which : event.button) != 1) return true;
if (setId != 0) clearInterval(setId);
bouncingBall.visibility="visible";
stillBall.visibility="hidden";
bouncingBall.left = (is.NS) ? e.pageX - 15 : event.offsetX - 15;
bouncingBall.top = (is.NS) ? e.pageY - 15 : event.offsetY - 15;
iter = 0;
setId = setInterval("generateGravity()", 20);
return true;
}
function generateGravity() {
if ((parseInt(bouncingBall.top)+iter < winH) && down) {
bouncingBall.top = parseInt(bouncingBall.top) + iter;
iter++;
return;
}
else {
if ((parseInt(bouncingBall.top)< winH) && down) {
bouncingBall.top = winH + 5;
return;
}
down = false;
up = true;
if (iter < 0 && parseInt(bouncingBall.top) > winH) {
clearInterval(setId);
bouncingBall.visibility = "hidden";
stillBall.visibility="visible";
setId = 0;
}
if (parseInt(bouncingBall.top) > 0 && up && iter >= 0) {
bouncingBall.top = parseInt(bouncingBall.top) - iter;
iter--;
if (iter%3 == 0) iter--;
return;
}
down = true;
up = false;
ďż˝ }
}
// End -->
</script>

</center>
</BODY>
</HTML>

This code will tell the user what browser he/she is using and what version for example this is mine

Browser Name: Netscape
Browser Version: 1.0.6


firefox ;)

code:
 



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<LINK href="general.css" rel="stylesheet" type="text/css">


</HEAD>

<BODY Background=../graphics/grayback.jpg>
<center><BR><BR><BR>
<script LANGUAGE="JavaScript">
<!-- Original: �Gregor (legreg@legreg.de) -->
<!-- Begin
var useragent = navigator.userAgent;
var bName = (useragent.indexOf('Opera') > -1) ? 'Opera' : navigator.appName;
var pos = useragent.indexOf('MSIE');
if (pos > -1) {
bVer = useragent.substring(pos + 5);
var pos = bVer.indexOf(';');
var bVer = bVer.substring(0,pos);
}
var pos = useragent.indexOf('Opera');
if (pos > -1) {
bVer = useragent.substring(pos + 6);
var pos = bVer.indexOf(' ');
var bVer = bVer.substring(0, pos);
}
if (bName == "Netscape") {
var bVer = useragent.substring(8);
var pos = bVer.indexOf(' ');
var bVer = bVer.substring(0, pos);
}
if (bName == "Netscape" && parseInt(navigator.appVersion) >= 5) {
var pos = useragent.lastIndexOf('/');
var bVer = useragent.substring(pos + 1);
}
document.writeln('<b>Browser Name: </b>' + bName + '<br>');
document.writeln('<b>Browser Version: </b>' + bVer + '<br>');
// �End -->
</script>

</center>
</BODY>
</HTML>

this one is a nice script you have to catch pikachu pokemon but he is text and you smack him and other stuff
 



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<LINK href="general.css" rel="stylesheet" type="text/css">
<script LANGUAGE="JavaScript">
<!-- Original: �Paul (Poke_Paul@hotmail.com) -->
<!-- Web Site: �www.angelfire.com/ak3/MewHiddenLair/ -->
<!-- Begin
now=new Date;
x=now.getTime() %32768;
function Random(min,max) {
x=(1103515245*x+12345) % 32768;
return Math.floor(x*(max-min+1)/32768+min);
}
var num = new Array;
num[0] = -1;
num[1] = 1;
var ctrsmit = new Array;
ctrsmit[0] = '<|x_x|>';
ctrsmit[1] = '<|!_!|>';
var i = 0, will2live = 0;
function livewill(j) {
i += j;
if (i == 0) tLiphe();
if (i < 6) stat(mood[3]);
if (oldstats == mood[3] && i >= 6) stat(mood[0]);
if (alive == true) {
barzies(i);
ďż˝ }
}
var bars='';
function barzies(num) {
bars='';
for (var i=0;i!=num;i++) bars += 'ďż˝';
document.ctrform.will.value = bars;
}
var mood = new Array;
mood[0] = 'Happy';
mood[1] = 'Mad';
mood[2] = 'Ticked-Off';
mood[3] = 'Suicidal';
mood[4] = 'Elated';
var Stat = new Array;
Stat[0] = 'Alive';
Stat[1] = 'Pokeball cleaned';
Stat[2] = 'Pokeball not messy';
Stat[3] = 'In pain';
Stat[4] = 'Dead';
Stat[5] = 'Infected!';
Stat[6] = 'Disinfected!';
Stat[7] = 'Not infected';
Stat[8] = 'Drooling';
var alive = false, aniID, statID, moodID, liveID, crapID, sickID, illID, normguy = '<( )>';
function gLiphe() {
normguy = '<( )>';
stat('Catching...');
livewill(15);
statID = setTimeout("stat(Stat[0])",3500);
setTimeout("alive = true",3500);
Animate(false,'(-o-)');
aniID = setTimeout("Animate(false,'<(o_o)>')",2500);
aniID = setTimeout("Animate(false,'(O_o)>')",3500);
aniID = setTimeout("Animate(false,'<(o_o)>')",4300);
aniID = setTimeout("Animate(false,'<(o_O)')",4500);
aniID = setTimeout("Animate(false,'<(o_o)>')",5300);
aniID = setTimeout("Animate(false,'(O_o)>')",5500);
aniID = setTimeout("Animate(false,normguy)",6500);livewill(15);
setTimeout("independence()",6501)
}
function ID(dep) {
clearTimeout(aniID);
clearTimeout(statID);
clearTimeout(liveID);
clearTimeout(crapID);
if (dep == true) clearTimeout(independ);
}
var f, t = ' ďż˝ ďż˝ ďż˝ ďż˝ ďż˝';
function Animate(auto,ctrex) {
if (auto == false) f = ctrex;
if (auto == true) t = spacey.substring(0,Pos());
document.ctrform.ctr.value = t + ctrex + poopie();
}
var indID, independ;
function independence() {
independ = setTimeout("Animate(true,f)",400);
independ = setTimeout("Animate(true,f)",1200);
independ = setTimeout("Animate(true,f)",2000);
independ = setTimeout("Animate(true,f)",2800);
independ = setTimeout("Animate(true,f)",3600);
indID = setTimeout("independence()",4000);
}
var spacey = ' ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝ ďż˝', k, l = 10;
function Pos() {
k = Random(0,1)
if (k == 0) {
if (t.length < 22) return l++;
else if (t.length >= 22) Pos()
}
if (k == 1) {
if (t.length > 0) return l--;
else if (t.length == 0) return l++;
ďż˝ }
}
var poop = false;
function poopie() {
if (poop == true) return " <<poo>> ";
else return '';
}
function eatpoop() {
if (poop == false) {
document.ctrform.phood.selectedIndex = 0;
stat(Stat[2]);
}
if (poop == true) {
ID(true);
eatpoopie();
ďż˝ }
}
function eatpoopie() {
poop = false;
eat(false,'<<poo>>');
aniID = setTimeout("Animate(false,'<(�o>)>')",750);
if (sick == false) setTimeout("befect()",4000);
}
var pasto,healthy,eaty='<(�o�)>',eati='<(�-�)>',eaty2;
function eat(health,pasti) {
healthy = health;
pasto = pasti;
if (sick == true) {
eaty = '<(�o�)>';
eaty2 = '<(�o)>';
eati = '<(ďż˝-ďż˝)>';
}
else {
eaty = '<(�o�)>';
eaty2 = '<(�o)>';
eati = '<(ďż˝-ďż˝)>';
}
Animate(false,eati +' ďż˝'+ pasto);
aniID = setTimeout("Animate(false,eaty +' ďż˝'+ pasto)",150);
aniID = setTimeout("Animate(false,eaty +' '+ pasto)",300);
aniID = setTimeout("Animate(false,eaty + pasto)",450);
aniID = setTimeout("Animate(false,eaty2+ pasto)",600);
setTimeout("phood(healthy)",650);
}
function pheed(antipasto) {
if (antipasto == 0) eat(true,'>o<');
else if (antipasto == 1) eat(true,'ďż˝');
else if (antipasto == 2) eatpoop();
}
function takeone() {
ID(true);
Animate(false,'<(ďż˝=ďż˝)>');
aniID = setTimeout("Animate(false,'<(>_<)>')",500);
aniID = setTimeout("Animate(false,'<(ďż˝=ďż˝)>')",1300);
aniID = setTimeout("Animate(false,'<(>_<)>')",2600);
aniID = setTimeout("Animate(false,normguy)",4800);
setTimeout("infekt()",4799);
setTimeout("poop = true",4799);
full = 0;
}
function cleancage() {
if (poop == false) stat(Stat[2]);
if (poop == true) {
poop = false;
Animate(false,normguy);
stat(Stat[1]);
clearTimeout(sickID);
ickcount = 0;
ďż˝ }
}
function tLiphe() {
normguy = '<(�_�)>';
poop = false;
clearTimeout(sickID);
clearTimeout(illID);
clearTimeout(indID);
ID(true);
sick = false;
full = 0;
l = 1;
i = 0;
aniID = setTimeout("Animate(false,normguy)",1);
statID = setTimeout("stat(Stat[4])",1);
barzies(0);
bruised = 0;
poked = false;
alive = false;
}
var oldstats, ick = '';
function stat(stats) {
ick = '';
oldstats = stats;
if (sick == true) ick = '[sick] ';
document.ctrform.ctrstatus.value = ick + oldstats;
}
var j;
function smite() {
if (sick == false) normguy = '<(<ďż˝>_<ďż˝>)>';
ID(true);
statID = setTimeout("stat(Stat[3])",10);
aniID = setTimeout("Animate(false,ctrsmit[Random(0,1)])",10);
liveID = setTimeout("livewill(num[0])",20);
aniID = setTimeout("Animate(false,normguy)",1300);
statID = setTimeout("stat(mood[1])",1300);
}
var full = 0;
function phood(salubrious) {
if (sick == false) normguy = '<( )>';
ID(true);
full++;
if (salubrious == true) livewill(num[1]);
aniID = setTimeout("Animate(false,eaty)",200);
aniID = setTimeout("Animate(false,eati)",700);
aniID = setTimeout("Animate(false,eaty)",1200);
aniID = setTimeout("Animate(false,eati)",1700);
aniID = setTimeout("Animate(false,eaty)",2200);
aniID = setTimeout("Animate(false,eati)",2700);
aniID = setTimeout("Animate(false,normguy)",3200);
if (full == 3) setTimeout("takeone()",6000);
if (full >= 3) full = 0;
}
var sick = false, ickcount = 0;
function infekt() {
ickcount++;
if (ickcount != 2) sickID = setTimeout("infekt()",30000);
if (ickcount == 2) befect();
}
function befect() {
sick = true;
setTimeout("stat(Stat[5])",500);
ickcount = 0;
besick();
normguy = '<(�_�)>';
}
function besick() {
livewill(num[0]);
Animate(false,normguy);
if (sick == true) illID = setTimeout("besick()",2000);
}
function dnfekt() {
if (sick == false) stat(Stat[7]);
if (sick == true) {
if (poop == false) clearTimeout(sickID);
normguy = '<( )>';
eat(false,'ďż˝');
sick = false;
setTimeout("stat(Stat[6])",4000);
ickcount = 0;
if (poop == true) infekt();
ďż˝ }
}
function scratchyscratchy() {
normguy = '<( )>';
ID(true);
statID = setTimeout("stat(Stat[8] +'(scratch scratch)')",710);
aniID = setTimeout("Animate(false,'ďż˝ p')",200);
aniID = setTimeout("Animate(false,'ďż˝ Pďż˝')",800);
aniID = setTimeout("Animate(false,'ďż˝ p ďż˝')",1400);
aniID = setTimeout("Animate(false,'� P��')",2000);
aniID = setTimeout("Animate(false,'� p ��')",2600);
aniID = setTimeout("Animate(false,'� P���')",3400);
aniID = setTimeout("Animate(false,'� p ���')",4200);
aniID = setTimeout("Animate(false,'� P ����')",5000);
aniID = setTimeout("Animate(false,': Pďż˝')",5600);
aniID = setTimeout("Animate(false,normguy)",6600);
statID = setTimeout("stat(mood[0])",6600);
liveID = setTimeout("livewill(num[1])",6600);
}
var bruised = 0, poked = false;
function poke() {
if (bruised >= 7) {
normguy='o_-';
aniID = setTimeout("Animate(false,'(O_-)')",1);
liveID = setTimeout("livewill(num[0])",1);
if (poked == false) statID = setTimeout("stat('You poked his eye out!!')",10);
aniID = setTimeout("Animate(false,normguy)",300);
poked = true;
}
if (bruised < 7) {
bruised++;
normguy = '<( )>'
aniID = setTimeout("Animate(false,' <(^o^)>')",1);
liveID = setTimeout("livewill(num[1])",1);
statID = setTimeout("stat('PikaPi...')",10);
aniID = setTimeout("Animate(false,normguy)",300);
ďż˝ }
}
// �End -->
</script>

</HEAD>

<BODY Background=../graphics/grayback.jpg >
<center>
<form name="ctrform">
<table BORDER="4" CELLSPACING="5" CELLPADDING="5" bgcolor="red">
<tr><td><font color="blue"><br>
<table>
<tr>
<th>Life</th>
<th>Status</th>
</tr>
<tr>
<td><div align="center"><center><p><input type="text" size="20" name="will"></td>
<td align="center"><input type="text" size="25" name="ctrstatus"></td>
</tr>
<tr align="center">
<th>Pikachu</th>
<th>Options</th>
</tr>
<tr align="center">
<td><input type="text" name="ctr" size="30" onFocus="if (alive == true) tLiphe()"></td>
<td><div align="center"><center><p><input type="button" value="Catch a Pikachu"
onClick="if (alive == false) gLiphe()"></td>
</tr>
</table>
<div align="center"><center>
<table>
<tr>
<td><input type="button" value="Smack" onClick="if (alive == true) smite()"></td></tr><tr>
<td><input type="button" value="Clean Pok�ball" onClick="if (alive == true) cleancage()"></td></tr><tr>
<td><input type="button" value="Give Medicine" onClick="if (alive == true) dnfekt()"></td>
</tr>
<tr>
<td><input type="button" value="Give Food"
onClick="if (alive == true) pheed(document.ctrform.phood.selectedIndex)">
<select name="phood" size="1">
<option>Rare Candy</option>
<option>Apple</option>
</select></td>
</tr>
<tr>
<td><input type="button" value="Scratch" onClick="if (alive == true) scratchyscratchy()"></td>
</tr>
<tr>
<td><input type="button" value="Poke Pikachu" onClick="if (alive == true) poke()"><br></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</form>

</center>
</BODY>
</HTML>

What is 50 % of 100 Answer:50
Or...
100 is what percent of 50 Answer: 200


this script u put the numbers and it answers it for you.

 



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="TextPad 4.4">
<LINK href="general.css" rel="stylesheet" type="text/css">
<script LANGUAGE="JavaScript">
<!-- Original: �Tom Richardson Jr. (gooftroop@geocities.com) -->
<!-- Begin
function calc1(form) {
a = form.a.value/100;
b = a*form.b.value;
form.total1.value = b;
}
function calc2(form) {
a = form.c.value;
b = form.d.value;
c = a/b;
d = c*100;
form.total2.value = d;
}

// �End -->
</script>

</HEAD>

<BODY Background=../graphics/grayback.jpg>
<center><BR><BR><BR>
<form name="form1">
<table border=1 cellpadding=4 cellspacing=1>
<tr>
<td align=center>What is
<input type="text" name="a" size=5>
% of <input type="text" name="b" size=5>?</td>
<td align=center>Answer: <input type="text" name="total1"
size=5 maxlength=40></td>
<td align=center><input type="button" value="Calculate"
onClick="calc1(this.form)"></td>
</tr>
<tr>
<td align=center colspan=3 align=center>Or...</td>
</tr>
<tr>
<td align=center><input type="text" name="c" size=5>
is what
percent of <input type="text" name="d" size=5>?</td>
<td align=center>Answer: <input type="text" name="total2"
size=5> %</td>
<td align=center><input type="button" value="Calculate"
onClick="calc2(this.form)"></td>
</tr>
</table>
</form>

</center>
</BODY>
</HTML>
[/code]



ill put this last code good one it calculates the wind chill you put the MPH and the tempature and click calculate.


[code=auto:0]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="TextPad 4.4">
<LINK href="general.css" rel="stylesheet" type="text/css">
<script LANGUAGE="JavaScript">
<!-- Original: �James P. Dildine (jpd@wlsmail.com) -->
<!-- Web Site: �www.mste.uiuc.edu/dildine/ -->

<!-- Begin
function windChill(form) {
wind=eval(form.wind.value);
temp=eval(form.temp.value);
chill=(0.0817*(3.71*(Math.pow(wind, 0.5))+
5.81-0.25*wind)*(temp-91.4)+91.4);
form.windchill.value = chill;
}
// �End -->
</script>

</HEAD>

<BODY Background=../graphics/grayback.jpg>
<center><BR><BR><BR>
<form action="" method=post name=windform>

<table border=1 cellpadding=3 cellspacing=0 width="250">
<tr>
<td align=center>
Wind Speed (MPH) =
</td>
<td align=center>
<input type=text name=wind value="" size=6>
</td>
</tr>
<tr>
<td align=center>
Air Temperature (�F) =
</td>
<td align=center>
<input type=text name=temp value="" size=6>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<br>
<input type=button value="Calculate Wind Chill" onclick="windChill(this.form)">
<p>
<input name=windchill type=text value="" size=10> ďż˝ F
</td>
<tr>
</table>

</center>
</BODY>
</HTML>

Notice from BuffaloHELP:
Enterend CODEBOX. Please watch the unnecessary blank spaces. A single line skip will just suffice.

Edited by OpaQue (see edit history)

Share this post


Link to post
Share on other sites

You know if you are going to give us the code, won't you provide us with the whole thing? I mean where is BALL.GIF and GRAYBACK.JPG?And for the long codes like that, please use CODEBOX instead of CODE.Thank you.

Share this post


Link to post
Share on other sites

You know if you are going to give us the code, won't you provide us with the whole thing? I mean where is BALL.GIF and GRAYBACK.JPG?

 

And for the long codes like that, please use CODEBOX instead of CODE.

 

Thank you.

178237[/snapback]


 

i notice that the ball.gif and gray.jpg ill try to put it tommoroy if i can, and how do you do those CODEBOX?

Share this post


Link to post
Share on other sites

how do you do those CODEBOX?

178240[/snapback]

Instead of CODE use CODEBOX. When you are composing a post, to the left, below all those smilies, you'll see the BB Code Help link. Study them! Learn them! Use them! And please read the YELLOW NOTE TAGS!!!

 

Thank you.

Share this post


Link to post
Share on other sites

oh my god but thank you sir ;) .a website of serious won't add so lots of java scripts or other scripts except html and php asp..:Plike Xisto.com..the index page of the Xisto or Xisto forum do you find some unuseful scripts? no,i am not finding of it.so if we just thinking for the guest of our sites,we will know that script will using so much computer memory of the client of Browser .so we should thinking for our guests.tihnking for a confiremd purpose site but not the one full of confused things..sorry :P guangdian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.