Let me start by saying that I am a complete HTML/JS n00b and just started messing around with this stuff today. I am not a web or software developer - I just need to create a functional webpage used for tracking data.
That said, I am currently experimenting with Javascript and am wondering why the following code does not work:
But the following does:
In the first case, clicking the button causes the popup alert box to appear. In the second case, the box does not appear, and windows reports the following JS error:
"Error: 'document.data_version_form.menu_value.value' is null or not an object"
It seems to have something to do with the fact that the text "form" appears in the name of the form. If I change that text to anything else, it works. For example, I can do:
<form name = "data_version_from">
as in example 2 below, and it will work.
At first I suspected that this was some keyword or reserved word, but then I looked at a list of all reserved javascript words:
link
and found that I could replace the "form" text with other supposedly reserved words such as "blur" and "frame", and the example would still work. Plus I thought reserved words could appear within larger words - it is only when they are used alone that they can cause an error.
What is going on here?
EDIT: something seems to be wrong with the spacing in my code
That said, I am currently experimenting with Javascript and am wondering why the following code does not work:
But the following does:
In the first case, clicking the button causes the popup alert box to appear. In the second case, the box does not appear, and windows reports the following JS error:
"Error: 'document.data_version_form.menu_value.value' is null or not an object"
It seems to have something to do with the fact that the text "form" appears in the name of the form. If I change that text to anything else, it works. For example, I can do:
<form name = "data_version_from">
as in example 2 below, and it will work.
At first I suspected that this was some keyword or reserved word, but then I looked at a list of all reserved javascript words:
link
and found that I could replace the "form" text with other supposedly reserved words such as "blur" and "frame", and the example would still work. Plus I thought reserved words could appear within larger words - it is only when they are used alone that they can cause an error.
What is going on here?
EDIT: something seems to be wrong with the spacing in my code