1. innerhtml Method
2. appendchild method http://www.cnblogs.com/changchangcc520/archive/2007/12/08/988088.html
Code
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "8. aspx. cs" inherits = "showmessagebox_8" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> No title page </title>
<SCRIPT type = "text/JavaScript" Language = "JavaScript">
Function appchild ()
{
DS = Document. createelement ("input ");
DS. type = "button ";
DS. Values = 22222;
// Ds. onclick = function aalert () {alert ("mmammamam ")};
DS. onclick = function () {aalert ()};
Document. Body. appendchild (DS );
}
Function inner ()
{
// Document. Body. innerhtml + = "<input type = 'button 'value = '000000' onclick = 'aalert ()'/> ";
Document. getelementbyid ("testdiv"). innerhtml + = "<input type = 'button 'value = '000000' onclick = 'aalert () '/> ";
}
Function aalert ()
{
Alert ("mmammamam ");
}
Function button1_onclick (){
TT ();
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Div id = "testdiv"> </div>
<Input id = "button1" type = "button" value = "appendchild method" onclick = "appchild ()"/>
<Input id = "button2" type = "button" value = "innerhtml method" onclick = "inner ()"/>
</Div>
</Form>
</Body>
</Html>