jQueryUI Dialog

HTML

<img class='img' src="http://media1.santabanta.com/full5/Nature/Animals/animals-89a.jpg" onclick="ChangeUrl()" id="image1">
    
<div id="myDialog">
    change url 
    <input type="text" id="myTextBox" />
</div>
   <script>
       function ChangeUrl(){ 
     $("#myDialog").dialog("open");

    var image1 = document.getElementById("image1");
            $("#myTextBox").val(image1.src);
    image1.src= url;
       }</script>

CSS

.img {
    height:200px;
    width:200px;
}

JavaScript

//Set up the dialog box
$("#myDialog").dialog({
    autoOpen  : false,
    modal     : true,
    title     : "A Dialog Box",
  
              function() {
                  var textValue = $('#myTextBox').val();
                  var image1 = document.getElementById("image1");
                  image1.src=textValue;
                  
              
             
                }
});