javascript - onclick event on image element in php does not work -
maybe stupid question don't this.
small example
<form id="frm1" action="" method="post"> <ol> <?php ($i=1; $i <= $amount; $i++) { $dirname = "fotos/"."gallery".$i."/"; $images = glob($dirname."*.jpg"); foreach($images $image) { echo '<li><img name="'."picture".$i.'" src="'.$image.'" onclick="this.form.submit();" /></li>'; break; } } ?> </ol> </form>
when submit form onclick event it's not working put simple alert()
in it, work.
can explain me this?
i think form not proper resolved way. try: onclick="document.getelementbyid('frm1').submit();"
but can't retrieve name attr of img tag way on server side. use <input type='hidden'
store clicked image request, ex.
Comments
Post a Comment