When exporting an Excel file today, we 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:
Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> ceshi </title>
<Script>
Function ()
{
Document. getElementById ('A'). value = "test ";
Alert (document. getElementById ('A'). value );
Return false;
}
</Script>
</Head>
<Body>
<Form>
<Input type = "hidden" id = "a" name = "a" value = ""/>
<Input type = "button" value = "excel" onClick = "javascript: a ();"/>
</Form>
</Body>
</Html>
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