javascript - Get image URL when click on picture -


i design popup window select imgage. code in index.php

<input type="button" value ="browse" onclick="browse_img()" /> <input type="text" id="img_url" name="img_url" value="selected img"/>  <script type="text/javascript">     function browse_img(){         window.open("img_browse.php","windows2");     } </script> 

this code in img_browse.php

<img id="img_id_1" src="url/puc1.jpg" onclick="select_img()"/>     <img id="img_id_2" src="url/puc2.jpg" onclick="select_img()"/> <input type="text" id="img_url" name="img_url" value="selected img"/> <scrip>    function select_img(){         var file_url=$(this).src;          alert(file_url);         document.getelementbyid("img_id_2").value=file_url;     } </scrip> 

the aler "undefined". me! , how pass img_url windows2 (img_browse.php) index.php

you like:

<img id="img_id_1" src="url/puc1.jpg" onclick="select_img(this.src)"/>     

and javascript:

function select_img(src) {   alert(src);   document.getelementbyid("img_id_2").value=src; } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -