How asign a value with javascript

Hi, i am using javascript in a field of a form for get a value of a user and asign it to other field, so i created a script javascript in event onclick:

var answer = prompt(“Quantity ?”,“2”);
document.F1.Quantity.value = answer;

When clicked on field this show prompt, but do not asign this value to other field.

Which is my error?