Click to See Complete Forum and Search --> : onmouseover php array


iceman2g
10-27-2004, 12:41 PM
I have a fairly simple piece of code. What it basically does is show an enlarged version of a thumbnail onmouseover.

I seem to be getting an error though. It says "Unterminated string constant".

Code:

<script type="text/javascript">

function Pic(source) {
document.getElementById("lrgPic").setAttribute("src",source)
}

</script>

<img id=\"lrgPic\" src='images/$image' border=\"0\">
<img src='images/thumb_$sec_image_array[$a]' onmouseover=\"Pic('\images/$sec_image_array[$a]')\"

Based on this code, what might be causing this.

7stud
10-27-2004, 04:36 PM
First, I got rid of all the escaping:

<img id="lrgPic" src='images/$image' border="0">
<img src='images/thumb_$sec_image_array[$a]' onmouseover="Pic('images/$sec_image_array[$a]')"

Then, when I replace all your php with some local files of mine:

<img id="lrgPic" src='green_square.jpg' border="0">
<img src='red_square.jpg' onmouseover="Pic('blue_square.jpg')"

there are no errors. So, try that yourself, and confirm that something is wrong with your php.