javascript - Adding Click function to input type image in php giving undefined error -
i trying make onclick function input type image. here 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 error opengallery not defined. wrong doing?
your javascript syntax invalid, should getting syntax error in console. should be:
function opengallery(url) { $.colorbox({width:"80%", height:"80%", iframe:true, href:"/pagetoopen.html"}); } var used declare local variables in function body. function arguments automatically declared local, var keyword not used there.
Comments
Post a Comment