[Greasemonkey] modify a javascript array

Tobias Orterer orterer at gmail.com
Tue Jul 5 05:08:51 EDT 2005


hi,

i want to modify a array in the javascript part of a page.

its like:
<html>
<body>
<script>
<!--
a[1] = new Array( '1', '2', '3' );
a[2] = new Array( '1', '2', '3' );
a[3] = new Array( '1', '2', '3' );
a[4] = new Array( '1', '2', '3' );

for( i = 0; i < a.length; i++ ) {
     var b = "<span title=\"" + a[i][1] + "\">" + a[i][0] + a[i][2] + "</span>";
     document.write( b );
}

-->
</script>
</body>
</html>


i want the a[i][1] _IN_ the <span> after the a[i][2], not in the
title. so i think one way is to manipulate the array after it is
created befor the for() or manipulate the var b declaration OR (and
thats my problem), if its possible to parse the javascript output
after the write(), just get the span title attribute and write it
befor the data in the span with DOM (getElementsByTag('span')[0].data
(.innerhtml? whatever...)).


has anyone a solution?

thx!



-- 
PGP: 1D87 2E28 B3A5 EEAE 19EB  01C1 ED45 5B31 39AA 1669


More information about the Greasemonkey mailing list