Without you inserting the entire contents of your form, I cannot be sure, but I am going to make a good guess here. Am I going to say that your tags for the fields of your user ID and password ONLY have name attributes on them?
When you work with forms in HTML, you must use 'name =' so that the parameter names are passed to the receiving script. This is what your script gives the id = blah & pwd = blah bit in the url or as a postal payload.
However....
When you access the values ββusing the DOM (document object model) as you are in the script, then you need to identify the element with the id = attribute.
The same is true for any element anywhere in your document that you need to access using a script in js.
If you notice also, you will get a warning, but just like not returning false, your focus call will never be called either, this will cause the script call to be canceled as an element with the name 'id' cannot.
add id = "id" and id = "pwd" next to your name = "id" and name = "pwd" attributes in your input tags, and you should find that everything will work properly. EG:
<input type="text" name="id" id="id" ... />
In the last note, I would recommend that you rewrite this function using something like jQuery, you will find the model more intuitive and cross-platform.
source share