Javascript produces weird behavior

Permalink
Hello,

I just wanted to use a simple alert function so that when people would click a picture it would say: "Oops, you first have to register to watch the video".

<form>
<input type="image" src="video.gif" onclick="alert('Oops, you first have to register to watch the video')">
</form>


After clicking it, the message box pops up like it is supposed to.

But, when I clicked OK it would send me to my homepage for some reason. I just want to stay on the same page.

How can I figure out how to fix this?

 
goodnightfirefly replied on at Permalink Reply
goodnightfirefly
<input type="image">
is a graphical submit button, by clicking it you are submitting the form.

Not sure what your question is exactly. Do you want to redirect to a different page?

Please provide more information about your code, unless what you posted is literally what you are using.
MeisterCoach replied on at Permalink Reply
I adjusted my original post. I don't want to go to my homepage after clicking OK. I just want to show the message box, nothing more.
goodnightfirefly replied on at Permalink Reply
goodnightfirefly
<img src="video.gif" onclick="alert('Your alert here')" />


Just use that line without the form parts.