[Javascript] need help with JScript!!

WolfSong wolfsong at midcoast.com
Thu Apr 26 14:56:56 CDT 2001


Hello all,

Yes, I'm a newbie.  I'm working on a presentation for my computer science class at the University of Maine at Augusta.  My presentation is taking apart a java/j script that works in both Netscape and IE and creating 2 separate scripts (ie, one Javascript and one jscript).  I took the program apart and created the Javascript without problem.  My problem is the jscript.  I cannot get it to work and have absolutely no idea what I'm doing wrong.  Can anyone help?  (NOTE: I've already downloaded the documentation at microsoft for jscript.)

Thanks,
Audra

Here is the jscript code and the html that goes with it.

var speed = 2; // smaller number moves the snow faster
var dx, xp, yp;    // coordinate and position variables
var am, stx, sty;  // amplitude and step variables
var i =0;
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();

for (i = 0; i < 10; ++ i) {  
dx[i] = 2;                        // set coordinate variables
xp[i] = Math.random()*(doc_width-50);  // set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20;         // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 0.7 + Math.random();
}
function ufoIE() {  // IE main animation function
for (i = 0; i < 10; ++ i) {  // iterate for every dot
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();

}
dx[i] += stx[i];
document.all[i].style.pixelTop = yp[i];
document.all[i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("ufoIE()", speed);
}
ufoIE();

-------------------------------------------------------------
Here is the html code that I wrote for the jscript:

<HTML>
<HEAD>
<TITLE>Internet Explorer - Animation - JScript
</TITLE>

</HEAD>
<BODY OnLoad="window.defaultStatus='JScript in Action!!';" bgcolor="#000000">


<div id="a" style = POSITION: absolute; Z-INDEX: i; VISIBILITY: visible; TOP: 15px; LEFT: 15px;><img src="ufo2.gif" border="0"></div>

<script src="ufoIE.asp"></script>

</body>
</html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010426/c0b4ce4f/attachment.htm>


More information about the Javascript mailing list