::楼主,新建一个文本文档,然后将下面的内容复制进去保存,最后把后缀名txt改为bat,将此文件放到你要处理的这个abc文件夹中,然后双击执行即可
::=========================================
for %%i in (*.js) do call :ss %%i
:ss
set aa=%1
rename "%aa%" "%aa:~4,4%"txt
用的是asp.net,GridView实现它的RowDataBound事件,具体看代码,仅供参考:前台:
<html xmlns="
<head runat="server">
<title></title>
<!--点击GridView任意行的位置,获取该行的ID值-->
<script type="text/javascript">
function getId(row_index) {
var grid_view = document.getElementById('<%=GridView1.ClientID %>')
var rows = grid_view.rows
var personID = rows[row_index].cells[0].innerHTML
alert("获取的ID为:" + personID)
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:BoundField HeaderText="ID" DataField="ID" HeaderStyle-Width="300px" ItemStyle-HorizontalAlign="Center"
HeaderStyle-BackColor="LightSkyBlue" />
<asp:BoundField HeaderText="Name" DataField="Name" HeaderStyle-Width="300px" ItemStyle-HorizontalAlign="Center"
HeaderStyle-BackColor="LightSkyBlue" />
<asp:BoundField HeaderText="Tel" DataField="Tel" HeaderStyle-Width="300px" ItemStyle-HorizontalAlign="Center"
HeaderStyle-BackColor="LightSkyBlue" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
后台代码:
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<Person> list = new List<Person>()
list.Add(new Person("001", "张三"))
list.Add(new Person("002", "李四"))
list.Add(new Person("003", "王五"))
list.Add(new Person("004", "赵六"))
list.Add(new Person("005", "何七"))
GridView1.DataSource = list
GridView1.DataBind()
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int row_index = e.Row.RowIndex + 1
e.Row.Attributes.Add("onclick", "getId(" + row_index + ")")
}
}
}
class Person
{
public Person(string id, string name)
{
ID = id
Name = name
}
private string id
public string ID
{
get { return id }
set { id = value }
}
private string name
public string Name
{
get { return name }
set { name = value }
}
private string tel
public string Tel
{
get { return tel }
set { tel = value }
}
}
<!doctype html><html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
/**
*
*
*
*这样的正则貌似最好用多条吧,一条的话不但写起来困难,你反馈给页面提示也不容易,所以我给你写一段验证代码,你来参考一下如何?
*如果你非要用一条正则,这正则实在是很难写,而且在JS里,还不支持正则预判,难度更高
*下面是实现的代码,你只要修改一下就可以直接拿去用了。
*
*
*
**/
function testPass(str){
var rC = {
lW:'[a-z]',
uW:'[A-Z]',
nW:'[0-9]',
sW:'[\\u0020-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E]'
}
function Reg(str, rStr){
var reg = new RegExp(rStr)
if(reg.test(str)) return true
else return false
}
if(str.length < 6){
document.title = '您的密码长度太短'
return false
}else{
var tR = {
l:Reg(str, rC.lW),
u:Reg(str, rC.uW),
n:Reg(str, rC.nW),
s:Reg(str, rC.sW)
}
if((tR.l && tR.u && tR.n) || (tR.l && tR.u && tR.s) || (tR.s && tR.u && tR.n) || (tR.s && tR.l && tR.n)){
document.title = '密码符合要求'
return true
}else{
document.title = '您的密码必须含有“小写字母”、“大写字母”、“数字”、“特殊符号”中的任意三种'
return false
}
}
}
</script>
<input type="text" id="pass" value="abc12C" /> <input type="button" value="测试" onClick="testPass(document.getElementById('pass').value)" />
</body>
</html>
上面的代码有说明,另外,这段代码是可以供你测试的,是一个完整的HTML文档,只要复制回去,测试一下就OK。