Hi,

In try.php I have code that will generate links on my page and an onclick event for each link.

The onclick event needs data from a mysql database. In try.php I read that data and put it into a javascript array.

My array appears to be correct, but in the generation of the onclick it doesn't like my reference to the array. (var printname = item[mylist][1] ; I had to rem out this instuction as it doesn't work)

Do I need to do a declaration so that dropsheet.js it can see my array ?
Or do I have a dumb syntaxe error that I'm not seeing ?

If I look at my source I do see my array
var myThing = 1;
var item = new Array();item[0]=new Array('Ange Gardien','rue Léopold Bellan','77260');item[1]=new Array('Auzon','Les Plats','63670');item[2]=new Array('Belle Allée','24 route d'Orléans','45380');item[3]=new Array('Escrebieux','984 rue de Quiéry','59553');item[4]=new Array('Espérance','6 rue de la Borderie','35000');item[5]=new Array('Eugénie','1 Sente des Demoiselles','60350'); var myOtherThing = 2;

Thanks in advance for any help
Patricia

try.php
HTML Code:
<?php
.....
while ($ligne = mysql_fetch_assoc($r_query)) {	
//create link
$temp_cell= "<a href=\"#\" id=\"permissions"; 
			$temp_i = (i + 1) ;
			$temp_cell.= $i+1  ;
			$temp_cell.= "\">";
			$temp_cell.= $lelien ;
			$temp_cell.= " </a>" ;
			echo "$temp_cell";
			// fill in array for javascrip
			$jsArray.="item[".$i."]=new Array('".$ligne[libelle]."','".$ligne[adr]."','".$ligne[cp]."');";
....
?>
<script>
	var myThing = 1;
	<?=$jsArray?>
	var myOtherThing = 2;
</script>
dropsheet.js
Code:
// JavaScript Document
addLoadListener(initDialog);

function initDialog()
// this function initiates the controls permissons
{
  for ( i = 1 ; i <= 25 ; i ++ )
  {
	// the following line puts the object in permissons
    var permissions = document.getElementById("permissions" + i);
	// now we create a function onclick
          //permissions.onclick = createDialog ;
    permissions.onclick = new Function("createDialog(" + i + ")");
  }
  return true;
}

function createDialog(mylist)
{
// the following 4 lines will no longer be needed once I get my array to work
	var noms = new Array(25) ;	
	noms[1] = "Ange Gardien";
	noms[2] = "Auzon";
	noms[3] = "Belle Allée";
var printname = noms[mylist] ;
//var printname = item[mylist][1] ;