87,907
社区成员
发帖
与我相关
我的任务
分享
<!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>
<title>表单编辑 </title>
<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function Button1_onclick() {
saveForm2(".content");
}
function saveForm2(contentCss) {
inputList = $("input");
for (var item = 0; item < inputList.length; item++) {
inputList.eq(item).val(inputList.eq(item).val());
}
inputList = $("input:checked")
for (var item = 0; item < inputList.length; item++) {
inputList.eq(item).attr("checked", "checked");
}
var postData = { "type": "add" };
postData.value = escape($(contentCss).html());
alert(postData.value); // John
// $.post(
// serviceUrl
// , postData
// , function (data) {
// alert("保存成功"); // John
// }
// , "json");
}
</script>
</head>
<body>
<form name="form1" method="post" action="editForm.aspx" id="form1">
<div>
</div>
<div class="control" style="background-color: #cccccc; width: 100%">
<input id="Button1" type="button" value="保存表单" onclick="return Button1_onclick()" />
</div>
<div id="divContent" class="content" style="">
<table border="1" cellpadding="1" cellspacing="1" style="width: 500px">
<tbody>
<tr>
<td>
<input type="text">
</td>
<td>
<input type="radio" value="on" >
</td>
<td>
<input type="checkbox" value="on" >
</td>
<td>
<select>
</select>
</td>
</tr>
<tr>
<td>
<textarea></textarea>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>
</p>
</div>
</form>
</body>
</html>