Click to See Complete Forum and Search --> : can u please explain what these mean??


lilaznclucle
08-29-2003, 02:44 PM
hi I am new to this javascript stuff can sum one explain to me wat this is and how it works?:confused:

This is one of them:

javascript: p=document.URL.indexOf("outwar")<0;a=document.getElementsByTagName("td");b=p?73:59;for(c=b;c<a.length-p?6:0;c+=5)if(a[c].innerHTML.replace(/\D/g,"")*1>a[b].innerHTML.replace(/\D/g,"")*1)b=c;window.location=a[b-2].firstChild.href;void(0);

This is the second

javascript:d=document;p=d.URL.indexOf("outwar")<0;a=d.getElementsByTagName("tr");b=p?55:37;c=p?6:1;m=(a.length-c-b+1)*((a.length-c-b)/2);x=0;for(i=b;i<a.length-c;i++)for(j=b;j<a.length-i+b-c;j++){if(a[j].childNodes[3].innerHTML.replace(/\D/g,"")*1<a[j+1].childNodes[3].innerHTML.replace(/\D/g,"")*1)a[j+1].swapNode(a[j]);x++;window.status="sorting..."+parseInt((x/m)*100)+"%";}d.getElementsByTagName("b")[p?2:4].innerHTML="List sorted by <a href='mailto:joeframbach@yahoo.com'>joeframbach</a>";void(0);

This is the third

javascript:d=document;g=function(t){return d.getElementsByTagName(t);};r=g("a").length-g("td")[g("td").length-2].innerHTML.match(/\d+/g)[1]*1-1;for(i=r;i<g("a").length-8;i++){setTimeout("a=window.open('http://www.outwar.com/page.php?x="+/\d+/.exec(g('a')[(i-6)].href)[/\d+/.exec(g('a')[(i-6)].href).length-1]+"')",(300000*(i-r)));};void(0);

This is the forth

javascript:w=window.open("");a=document.getElementsByTagName("a");for(c=32;c<a.length-9;c++)w.document.write("<iframe src='http://www.outwar.com/managecrew.php?playername="+a[c].innerHTML+"&submit=Invite' width='1%' height='1%'></iframe>");void(0);

this is the fifth

javascript:w=window.open("");a=document.getElementsByTagName("a");for(c=32;c<98;c++)for(i=0;i<3;i++)w.document.write("<iframe src='http://www.outwar.com/doattack.php?attackname="+a[c].innerHTML+"&message=random&attacks=10' width='1%' height='1%'></iframe>");void(0);

this is the sixth

javascript:w=window.open("");a=document.getElementsByTagName("a");w.document.write("<textarea id='names' cols='25' rows='100'></textarea>");for(c=32;c<a.length-9;c++)w.names.innerHTML+="\n"+a[c].innerHTML+"\n";void(0);

:( I dont understand much the most i do with javascript is copy and paste it to my webpages' head or body....

if anyone replies to it and would be generous enough to explain just tell me which one ur explaining(1st...6th)

Well Thanks everyone

Khalid Ali
08-29-2003, 04:47 PM
the code you psted in most cases is simpley assigning reference to different object.To understand this better you'll need to buy a book..or may find some tutorials..on google

gcrowan
08-29-2003, 04:54 PM
I'll try to break it down and someone else can weed through for the whys of this thing.

java script: p=document.URL.indexOf("outwar")<0;

returns true if the position of this string "outwar" in the URL of the page if is less than zero. Lets call the position X. The statement says p=X<0

a=document.getElementsByTagName("td");
returns array of all table data element in the page.

b=p?73:59;
if p is true then b=73 else b=59.

for(c=b;c<a.length-p?6:0;c+=5)
Loop statement. Variable c is our counter. The loop continues as long as c is less than a.length-p?6:0. At the end of each loop the counter(c) is incremented by 5.
a.length is the number of table data tags on the page.
If p is true then it is 6 else it is 0.
If there are five table data tags and p is false then the conditional statement would read: c<5-0.

the next statement will be run for each loop of the previous statement. (each loop creates a new value for the variable c )

if(a[c].innerHTML.replace(/\D/g,"")*1>a[b].innerHTML.replace(/\D/g,"")*1)b=c;
Conditional statement.
a is an array of td tags. a[c] is the index of a particular td tag within this array. EX. a[0] would be the first td tag in the array and a[1] would be the second and so on. Notice the variable c is incremented by 5 so the loop might look for a[73],a[78],a[83] and so on.

a[c].innerHTML.replace(/\D/g,"")*1
replaces any character other than a digit with nothing or in other words eliminates all but digits.
EX. <td>abcd</td> would return 0 or <td>5</td> would return 5.
Our statement asks if the digits in td tag[c] is greater than the digits in td tag[b].

If our conditional statement is true then....

window.location=a[b-2].firstChild.href;
void(0);

Now I understand document.children or element.children but I have never heard of a firstChild property so I am assuming this is not a javascript property.
td tag a[b-2] has a property writen to it called firstChild which contains an href or url as its value. The "void" operator then forces the expression to have no value. This allows us to assign a url to window.location but then not display the url in the browser.

I think you can probably work out the rest as it seems to cover the same types of operations. Hope I helped.

lilaznclucle
08-30-2003, 11:26 PM
OmG thank you very much... I think ill look through google and thank you for explaining the code in parts you have been very helpful...Thank you so very much!!!

lilaznclucle
09-02-2003, 01:30 PM
Thanks i understand the script more now... but i want to kno how i can make a popup window and make it redirect to one of my scripts thus making a new window look for the tag and stuff.... thanks alot cya