I’m currently writing a template for a django project and am a complete javascript beginner. The part of my template in question looks like this:
<form action='/gh/' method='GET'>
<label>Synchronisation:</label>
<input type='image' src='/site_media/images/sync.png' height='27', width='27' onclick="return confirm('Sind Sie sicher, dass Sie Synchronisieren wollen?');" alt="Synchronisation"></input>
</form>
Now if i click the image (sync.png) I get a confirm box where I can choose Ok or Cancel. Now If Ok is clicked i would like to show an image. How do I have to write this?
What you need is a confirm box: so you have to do something like this:
Creat a function to call on the on click:
That ought to do the trick. so just add button_on_click() on the onclick attribute of the element