OMG ....... che pollo !!!!!
cacchio vero c'era scritto pure nelle API .....
PWNED LIKE A CHICKEN !!!!
ghghghghgh grazzie ora fuge posto lo script corretto :
Attenzione il forum mi onverte START TEST !!!!!Codice PHP:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
<head>
<title>TEST SORTING</title>
<script type="text/javascript">
var B1 = null ;
var B2 = null ;
var B1_STR = "" ;
function init()
{
B1 = document.getElementById( "execution" ) ;
B2 = document.getElementById( "result" ) ;
}
function startTest()
{
var a1 = [
{ id:1 },
{ id:5 },
{ id:3 },
{ id:2 },
{ id:7 },
{ id:6 },
]
B1_STR = "<pre>START SORTING\n-----------------------------\n" ;
var a2 = a1.sort( sorter )
B1_STR +="\n-----------------------------\nEND SORTING</pre>" ;
var str = "<pre>" ;
for( var i=0 ; i<a2.length ; i++ )
{
str += "["+i+"] => "+a2[i].id+"\n" ;
}
str += "</pre>" ;
B1.innerHTML = B1_STR ;
B2.innerHTML = str ;
}
function sorter( a,b )
{
B1_STR +=" ["+a.id+"] < ["+b.id+"] \n" ;
return a.id-b.id ;
}
</script>
</head>
<body onload="init()">
[url="javascript:startTest()"]START TEST !!!!! [/url]
<table width="500">
<tr>
<td width="50%">EXECUTION</td>
<td width="50%">RESULT</td>
</tr>
<tr>
<td valign="top"><div id="execution"></div></td>
<td valign="top"><div id="result"></div></td>
</tr>
</table>
</body></html>
in START TEST !!!!!
Se volete testare togliete il "-" dalla chiamata js Ma ma ma ma perche' nn posso scrivere javascript tutto attaccato ??? mah sara per evitare injections![]()
Cmq fate attenzione quando usate il codice a quella chiamata.

Rispondi quotando