Copy codeThe Code is as follows:
<! 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>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> automatically fill in the Form </title>
<Style>
Body {font-size: 62.5% ;}
Label, input {display: block ;}
Input. text {margin-bottom: 12px; width: 95%; padding:. 4em ;}
Fieldset {padding: 0; border: 0; margin-top: 25px ;}
H1 {font-size: 1.2em; margin:. 6em 0 ;}
Div # users-contain {width: 350px; margin: 20px 0 ;}
Div # users-contain table {margin: 1em 0; border-collapse: collapse; width: 100% ;}
Div # users-contain table td, div # users-contain table th {border: 1px solid # CCC; padding:. 6em 10px; text-align: left ;}
. Ui-dialog. ui-state-error {padding:. 3em ;}
. ValidateTips {border: 1px solid transparent; padding: 0.3em ;}
</Style>
<Script type = "text/javascript" language = "javascript" src = "jquery-1.7.1.min.js">
</Script>
<Script type = "text/javascript" language = "javascript" src = "jquery-ui-1.8.18.custom.min.js">
</Script>
<Link rel = "stylesheet" href = "ui-lightness/jquery-ui-1.8.18.custom.css"/>
<Script type = "text/javascript" language = "javascript">
$ (Function (){
$ ("# Dialog"). dialog ({
AutoOpen: false,
Modal: true,
Buttons :[
{
Text: "create on account ",
Click: function (){
Var $ tr = $ ("<tr> <td>" + $ ("# username "). val () + "</td> <td>" + $ ("# email "). val () + "</td> <td>" + $ ("# pas "). val () + "</td> </tr> ");
// Alert ($ tr );
$ Tr. appendTo ("# users ");
$ ("# Dialog"). dialog ("close ");
}
},
{
Text: "cancel ",
Click: function (){
$ ("# Dialog"). dialog ("close ");
}
}
]
});
$ ("# Dialog_link"). click (function (){
$ ("# Dialog"). dialog ("open ");
});
})
</Script>
</Head>
<Body>
<Div id = "users-contain" class = "ui-widget">
<H1> Existing Users: <Table id = "users" class = "ui-widget-content">
<Thead>
<Tr class = "ui-widget-header">
<Th> name </th>
<Th> Email </th>
<Th> password </th>
</Tr>
</Thead>
<Tbody>
<Tr>
<Td> John Doe </td>
<Td> john.doe@example.com </td>
<Td> johndoe1 </td>
</Tr>
</Tbody>
</Table>
</Div>
<A href = "#" id = "dialog_link" class = "ui-state-default ui-corner-all" style = "font-size: 18px "> Create a new user </a>
<! -- Dialog Box $ ("# dialog"). dialog () is a dialog box, which is hidden on the page. -->
<Div id = "dialog" title = "create new user" style = "display: none">
Name <br> <input type = "text" id = "username">
Email <br> <input type = "text" id = "email">
Password <br> <input type = "password" id = "pas">
</Div>
</Body>
</Html>