submit onlick prompt not working with IE??!!

G

Geoff Cox

Hello,

Very odd this?

I have a form which has

<input name="Submit" type="Submit" value="Click to send _
when finished" onclick="getName()">

and

function getName() {
var yourname = prompt("please give your first name and _
second name","type first name and second name here");
document.demoForm1.name.value = yourname;
}

This works OK with Firefox but not with Internet Explorer! No window
comes up asking for the name - just skips this part and sends the form
info by email.

Why should this be?!

Cheers

Geoff
 
G

Geoff Cox

Geoff Cox said the following on 4/10/2007 4:40 AM:

Because the form is getting submitted before the prompt comes up.

Randy,

I don't think so because it works for me with IE and Mozilla - someone
else does not see the prompt with IE, not even after the form has been
submitted.

Cheers

Geoff
 
L

Lee

Geoff Cox said:
Randy,

I don't think so because it works for me with IE and Mozilla - someone
else does not see the prompt with IE, not even after the form has been
submitted.

Cheers

Geoff

Avoid using the onclick handler of a submit element.
Using the onsubmit handler of the form is more reliable.
Neither should be used to obtain more information from the user,
since there's little opportunity to validate the new data.


--
 
G

Geoff Cox

Avoid using the onclick handler of a submit element.
Using the onsubmit handler of the form is more reliable.
Neither should be used to obtain more information from the user,
since there's little opportunity to validate the new data.

Thanks Lee, in fact I have gone back to using a simple text box!

Cheers

Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top