A program suddenly went wrong recently,
I found that I previously wrote a JavaScript function in the program to call the _ dopost function deleteapplication (eventtarget, eventargument) provided by Asp.net)
{
If (window. Confirm ("Are you sure? "))
_ Dopostback (eventtarget, eventargument );
}
As a result, we are surprised to find that the JavaScript code that we often see is not generated in the entire HTML code. <script language = "JavaScript" type = "text/JavaScript">
<! --
Function _ dopostback (eventtarget, eventargument ){
VaR theform;
If (window. Navigator. appname. tolowercase (). indexof ("Microsoft")>-1 ){
Theform = Document. form1;
}
Else {
Theform = Document. Forms ["form1"];
}
Theform. _ eventtarget. value = eventtarget. Split ("$"). Join (":");
Theform. _ eventargument. value = eventargument;
Theform. Submit ();
}
// -->
</SCRIPT>
<Input type = "hidden" name = "_ eventtarget" value = "/>
<Input type = "hidden" name = "_ eventargument" value = ""/>
Because these are automatically generated by. net, there is a problem here. Under what circumstances will Asp.net automatically generate these codes?
According to my idea, if Asp.net finds that there is an event processing control during compilation, it will automatically generate the code.
A program error occurs because there is no event-supported control on my page,
The processing method is to add a button and set its style visiblity = hidden,
Asp.net automatically generates the above Code.
Note: If you set the visible = false of the button, this method will not allow ASPNET to automatically generate the above Code.