添加Click函数在php中输入类型图像给出未定义的错误

I am trying to make an onClick function from input type image. Here is the code

<td>
    <?php if($ring[ "bandPaths"] !='' ) echo '
<input id="bandImage" type="image" src="http://thevowapp.com/iphoneapp/vowstore/bands/'. $ring[ 'bandPaths'] . '" onClick="openGallery('.$ring[ 'bandPaths']. ');" style="width:100px; height:100px; margin-left: 10px;">
'; ?>
</td>

<script>
    function openGallery(var url) {
        $.colorbox({
            width: "80%",
            height: "80%",
            iframe: true,
            href: "/pagetoopen.html"
        });
    }
</script>

i get the error openGallery is not defined. What wrong am i doing?

Your Javascript syntax is invalid, you should be getting a syntax error in the console. It should be:

function openGallery(url)
{    
  $.colorbox({width:"80%", height:"80%", iframe:true, href:"/pagetoopen.html"});
}

var is only used to declare local variables in the function body. Function arguments are automatically declared as local, so the var keyword is not used there.

Try wrapping the string you are passing through to the function:

<td>
<?php if($ring["bandPaths"] != '') 
echo '<input id="bandImage" type="image" src="http://thevowapp.com/iphoneapp/vowstore/bands/'.  $ring['bandPaths'] .'" onClick="openGallery(\''.$ring['bandPaths'].'\');" style="width:100px; height:100px; margin-left: 10px;">'; ?>
</td> 

Notice the \' wrapping the string.