PDA

View Full Version : showing an progress indicator



furynick
05-11-2007, 01:07 PM
hi
i don't know anything about javascript.
i want to do that;
there is a submit button. that sends a file to my server.
i want it to display loading.gif when i pressed the submit button.

for example this is my html code

<input type="button" onclick="ShowImage('loading.gif')" value="Submit">
when i press "Submit" it should display loading.gif

the problem is i don't know how can i code the ShowImage function.
please help
thanks.

thetestingsite
05-11-2007, 04:26 PM
Try this (in the head of the document):



<script type="text/javascript">
function ShowImage(img) {

var obj = document.getElementById('imgDiv');

obj.innerHTML = '<img src="'+img+'" alt="Loaded Image">';
}
</script>


Then, wherever you want the image to show up (when you click on the button), place this:



<div id="imgDiv"></div>


Hope this helps.

furynick
05-11-2007, 04:37 PM
thanks a lot :)))