Reputation: 568
So I did a demonstration at work on a website I'm developing. I develop in Firefox, but IE10 is the default on the conference room computer. The first page I load has a form with two choices, a button to enter a new person, or a button to edit an existing person (they're just page redirects, the actual work happens later)
they didn't work.
Open the page in Firefox, they worked just fine. Every other button in the website works fine in IE10, it's only those two.
I'm using javascript to control the form action, and all the buttons have the same action, just the form names and the redirect is different. this works fine:
function handle_profile()
{
if(document.pressed == "new_instructor")
document.inst_act_choice.action = "instructors.php?mode=new";
if(document.pressed == "edit_instructor")
document.inst_act_choice.action = "instructor_profile.php?mode=select";
}
if i change it back to
function handle_profile()
{
if(document.pressed == "new_instructor")
document.selection.action = "instructors.php?mode=new";
if(document.pressed == "edit_instructor")
document.selection.action = "instructor_profile.php?mode=select";
}
then it breaks. but it doesn't break in firefox, or if i use IE10 in compatibility mode. haven't tested chrome, etc. I can't find any documentation saying selection is invalid as a form name.
Upvotes: 2
Views: 286
Reputation: 115970
selection
is a perfectly valid form name, but it's not accessible as document.selection
because document.selection
is already in use in IE.
To make a clear cross-platform example: imagine if your form were named getElementById
. That's a perfectly valid element name, too, but you shouldn't expect that it would be accessible via the identifier document.getElementById
.
You can instead access it by ID through document.forms["my_form_id"]
or document.getElementById("my_form_id")
.
Upvotes: 5