This article mainly introduces the conflict between the js function name and the form element with the same name. If you need it, refer to it, I hope it will be helpful to everyone. When exporting Excel today, I used Form input den to differentiate export and search. At the beginning, The onClick event function name in js is the same as that in hidden. Result: The row of objects that call the function does not support this attribute.
I couldn't find the cause for a long time. At the beginning, I thought it was wrong to write a letter, only to find that the js function was not executed at all. Later, I was unable to directly call other functions and found that they were useful. I thought it was the reason for the function name and changed the function name. Then, change the id in input to the same function name, and an error is reported. The ThinkPHP template parsing bug was still thought before the following example was verified. As shown in the following example, the function name in Javascript cannot be the same as the id in the element.
For example:
The Code is as follows:
Ceshi
Script
Function ()
{
Document. getElementById ('A'). value = "test ";
Alert (document. getElementById ('A'). value );
Return false;
}
Script
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; CIBA;. net clr 2.0.50727)
Timestamp: Thu, 27 Jan 2011 13:30:09 UTC
Message: the object does not support this attribute or method.
Row: 17
Character: 1
Code: 0
URI: file: // C:/Documents % 20and % 20 Settings/Administrator/desktop/test.html