Hello, I have some PHP code that looks like this:
<?php
for ($index=1; $index<=$numLinks; $index++)
{
echo ‘<div id=”nav”><a href=”” onclick=”SetClientImage(‘ . $client .’)” onmouseover=””><img src=”images/dot_unselected.jpg” border=”0″ alt=”unsel_dot”></a></div>’;
}
?>
The variables $numLinks and $client are passed in from another HTML doc. The javascript code looks like this:
<script type=”text/javaScript”>
<!– hide script from old browsers
function SetClientImage(client)
{
alert (“hello”);
}
// end hiding script from old browsers –>
</script>
In other words, I’m trying to pass a PHP variable to a javascript function. I know this is probably a noob question but I can’t seem to be able to get it to work when I’m sure it should. The HTML part of it seems to display properly but passing $client to the JS function doesn’t seem to work. Can someone give me any ideas as to what’s wrong with my code? TIA.?