动态添加删除表单
来源:互联网 发布:sqlserver 2008 安装 编辑:程序博客网 时间:2024/05/01 04:15
//读取文件夹中某类型的图片
using System.IO;
DirectoryInfo imagesfile = new DirectoryInfo(Server.MapPath("~/image"));
FileInfo[] fileinfo = imagesfile.GetFiles("*.jpg");
foreach (FileInfo fi in fileinfo)
{
strpic += "<img src=/"../image/" + fi.Name + "/" />";
}
<!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>无标题文档</title>
<script type="text/javascript">
function $(obj)
{
return document.getElementById(obj);
}
function cloneObj(oClone, oParent, count)
{
if(oParent.childNodes.length < count)
{
var newNode = oClone.cloneNode(true); //复制表单
oParent.appendChild(newNode);
return newNode;
}
return false;
}
function delObj(oParent, count)
{
if(oParent.childNodes.length > count)
{
oParent.removeChild(oParent.lastChild); //删除最后一个
return true;
}
return false;
}
function clonePoll(maxpoll, arrayinput, arraydiv)
{
for(c=0;c<arrayinput.length;c++)
{
var newNode = cloneObj($(arrayinput[c]), $(arraydiv[c]) , parseInt(maxpoll) + 1);
if(!newNode)
{
alert("时间项不能多于 " + maxpoll + " 个");
}
var inputs = newNode.getElementsByTagName("input");
for(i in inputs)
{
inputs[i].value = "";
if(inputs[i].name == arraydiv[c])
{
inputs[i].id = arraydiv[c];
}
}
}
}
</script>
</head>
<body>
<div id="polloptions">
<div id="divPollItem" style="float: left;">
<input type="text" size="30" id="pollitemid" name="pollitemid" maxlength="30" onfocus=" " />
</div>
</div>
<div id="polloptions2" style="float: left;">
<div id="divPollItem2">
<input type="text" size="30" id="pollitemid2" name="pollitemid2" maxlength="30" onfocus=" " />
<input type="file" />
</div>
</div>
<input name="button" type="button" onclick="clonePoll('20',['divPollItem','divPollItem2'],['polloptions','polloptions2'])" value="增加时间项" />
<input name="button" onclick="if(!delObj(document.getElementById('polloptions'),1) || !delObj(document.getElementById('polloptions2'),1)){alert('时间项不能少于1个');}" type="button" value="删除时间项" />
</body>
</html>
- 动态添加删除表单
- js动态添加删除表单
- 动态的添加、删除表单
- jquery动态添加表单删除表单
- 动态表单添加及动态删除元素
- JavaScript 动态删除/添加HTML表单元素
- 使用JQuery 表单动态添加和删除行
- jquery + php动态添加删除表单的方法
- 第13篇:Angular-表单动态添加删除
- Angular4实现动态添加删除表单输入框功能
- 表单添加 删除 搜索
- 添加 删除 修改表单
- 动态添加表单
- 动态添加表单元素
- 动态 添加 表单控件
- 动态添加删减表单
- jquery表单列表添加删除
- jQuery表单添加与删除..
- kruscal最小生成树算法
- how to speak during the interiews
- Heritrix1.14.3 在Eclipse 配置总结
- EXT核心API详解(十一)_Ext.data.Store/GroupingStore/JsonStore/SimpleStore
- gcc使用简介
- 动态添加删除表单
- iconv转换编码格式 gbk utf-8
- 使用云计算~Eucalyptus tools安装到centos5.3记录日志
- spring 配置dbcp连接池不能释放,
- VS2005 Macros for Build Commands and Properties
- ASP.NET跨页面传值技巧总结
- Eucalyptus使用日志
- Using Jersey (RESTful Web Services) and Spring (Dependency Injection) Together
- js 改变gridview样式