Jump to content

schabluk

Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Poland, Warsav

schabluk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi folks and sorry for my bad English ;] i have a problem with script I want to run from onLoad HTML attribute. take a look at this code... [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> </HEAD> <BODY> <script LANGUAGE="JavaScript"> <!-- SNOW_dx = new Array();SNOW_xp = new Array();SNOW_yp = new Array();SNOW_am = new Array();SNOW_stx = new Array();SNOW_sty = new Array();for (i = 0; i < 20; ++ i){SNOW_dx[i] = 0; SNOW_xp[i] = Math.random()*(650-50);SNOW_yp[i] = 36 + Math.random()*650;SNOW_am[i] = Math.random()*20;SNOW_stx[i] = 0.02 + Math.random()/10;SNOW_sty[i] = 0.7 + Math.random();if (i == 0) makeFlake(i);else makeFlake(i);}function makeFlake(i){var daBody = document.getElementsByTagName('body')[0];hcXdiv = document.createElement('div');hcXimg = document.createElement('img');hcXdiv.appendChild(hcXimg);daBody.appendChild(hcXdiv);hcXdiv.setAttribute('id', 'SNOW_flake' + i);hcXdiv.style.position='absolute';hcXimg.setAttribute('src', 'http://localhost/icons/folder.gif');};function SNOW_Weather(){for (i = 0; i < 20; ++ i){SNOW_yp[i] += SNOW_sty[i];if (SNOW_yp[i] > 650-50){SNOW_xp[i] = Math.random()*(650-SNOW_am[i]-30);SNOW_yp[i] = 0;SNOW_stx[i] = 0.02 + Math.random()/10;SNOW_sty[i] = 0.7 + Math.random();}SNOW_dx[i] +=SNOW_stx[i];document.getElementById('SNOW_flake'+i).style.top=SNOW_yp[i]+'px';document.getElementById('SNOW_flake'+i).style.left=SNOW_xp[i] + SNOW_am[i]*Math.sin(SNOW_dx[i])+'px';}setTimeout('SNOW_Weather()',10);} //--> </SCRIPT> <img src="http://www.google.pl/images/hp0.gif" onLoad="javascript:SNOW_Weather();"> </BODY> </HTML> [/code] it works fine, but if I want to put variables and functions declaration into onLoad attribute, \ it crash... : [code] <img src="http://www.google.pl/images/hp0.gif" onLoad="javascript:SNOW_dx = new Array();SNOW_xp = new Array();SNOW_yp = new Array();SNOW_am = new Array();SNOW_stx = new Array();SNOW_sty = new Array();for (i = 0; i < 20; ++ i){SNOW_dx[i] = 0; SNOW_xp[i] = Math.random()*(650-50);SNOW_yp[i] = 36 + Math.random()*650;SNOW_am[i] = Math.random()*20;SNOW_stx[i] = 0.02 + Math.random()/10;SNOW_sty[i] = 0.7 + Math.random();if (i == 0) makeFlake(i);else makeFlake(i);}function makeFlake(i){var daBody = document.getElementsByTagName('body')[0];hcXdiv = document.createElement('div');hcXimg = document.createElement('img');hcXdiv.appendChild(hcXimg);daBody.appendChild(hcXdiv);hcXdiv.setAttribute('id', 'SNOW_flake' + i);hcXdiv.style.position='absolute';hcXimg.setAttribute('src', 'http://localhost/icons/folder.gif');};function SNOW_Weather(){for (i = 0; i < 20; ++ i){SNOW_yp[i] += SNOW_sty[i];if (SNOW_yp[i] > 650-50){SNOW_xp[i] = Math.random()*(650-SNOW_am[i]-30);SNOW_yp[i] = 0;SNOW_stx[i] = 0.02 + Math.random()/10;SNOW_sty[i] = 0.7 + Math.random();}SNOW_dx[i] +=SNOW_stx[i];document.getElementById('SNOW_flake'+i).style.top=SNOW_yp[i]+'px';document.getElementById('SNOW_flake'+i).style.left=SNOW_xp[i] + SNOW_am[i]*Math.sin(SNOW_dx[i])+'px';}setTimeout('SNOW_Weather()',10);}SNOW_Weather();"> [/code] I'm out of idea... simple scripts like [code] <BODY onLoad="text= new Array('ala');alert(text);"> [/code] works for me..
×
×
  • Create New...

Important Information

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.