durangod
10-30-2012, 01:33 AM
Hi can i mix php and javascript on an onclick function call like this
<script type="text/javascript">
function show_big()
{
<?php
$k=0;
foreach($fullpic_array as $key => $imagelink)
{
/* remove the single quotes from each value now that you have the comma seperation */
$fullpic_array[$k] = str_replace("'","",$fullpic_array[$k]);
$medpic_array[$k] = str_replace("'","",$medpic_array[$k]);
$imagenow = "<a href='".$fullpic_array[$k]."' rel='lightbox[myprofile]'><img src='".$CONST_LINK_ROOT.'/'.$medpic_array[$k]."' border='0' alt='' /></a>";
echo $imagenow;
$k++;
}//close foreach
?>
}//close function show_big
</script>
and then i call it like this
Total pics = <a href="#" onclick="show_big();"><?=$no_of_pics;?></a>
its not working which is why im asking lol
<script type="text/javascript">
function show_big()
{
<?php
$k=0;
foreach($fullpic_array as $key => $imagelink)
{
/* remove the single quotes from each value now that you have the comma seperation */
$fullpic_array[$k] = str_replace("'","",$fullpic_array[$k]);
$medpic_array[$k] = str_replace("'","",$medpic_array[$k]);
$imagenow = "<a href='".$fullpic_array[$k]."' rel='lightbox[myprofile]'><img src='".$CONST_LINK_ROOT.'/'.$medpic_array[$k]."' border='0' alt='' /></a>";
echo $imagenow;
$k++;
}//close foreach
?>
}//close function show_big
</script>
and then i call it like this
Total pics = <a href="#" onclick="show_big();"><?=$no_of_pics;?></a>
its not working which is why im asking lol