Jump to content

Declaring JavaScript variables in a Lopp


james909

Recommended Posts

 
I am trying to declare javascript variables from php array values using a loop.
 
Trying to declare javascript var h1 as php array value from $array[1][h], and h2 as $array[2][h], and h3 as $array[3][h],and so on...
 
Here is my code:
<SCRIPT LANGUAGE="JavaScript">

for (var i=0;i<61;i++)
{
var h[i] = "<?php echo $array[i][h] ?>";
var hl[i] = "<?php echo $array[i][hl] ?>";
var hs[i] = "<?php echo $array[i][hs] ?>";
} 

</script>

 When I <script type="text/javascript"> document.write(h1); </script> it is blank

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.