<!-- AspNetPager V7.0.2 for VS2005 & VS2008 Copyright:2003-2007 Webdiyer (www.webdiyer.com) -->
<div id="Pager" style="text-align:right;">
<a disabled="disabled" style="margin-right:5px;">首页 </a> <a disabled="disabled" style="margin-right:5px;">上一页 </a> <span style="margin-right:5px;font-weight:Bold;color:red;">1 </span> <a href="javascript:__doPostBack('Pager','2')" style="margin- right:5px;">2 </a> <a href="javascript:__doPostBack('Pager','3')" style="margin-right:5px;">3 </a> <a href="javascript:__doPostBack('Pager','2')" style="margin- right:5px;">下一页 </a> <a href="javascript:__doPostBack('Pager','4')" style="margin-right:5px;">末页 </a>
</div>
<!-- AspNetPager V7.0.2 for VS2005 & VS2008 End --> 要求:移除外层的div,将javascript:__doPostBack('Pager','2')替换成诸如:http://www.sohu.com/2
结果:
<div id="Pager" style="text-align:right;">
<a disabled="disabled" style="margin-right:5px;">首页 </a> <a disabled="disabled" style="margin-right:5px;">上一页 </a> <span style="margin-right:5px;font-weight:Bold;color:red;">1 </span> <a href="http://www.sohu.com/2" style="margin- right:5px;">2 </a> <a href="http://www.sohu.com/3" style="margin-right:5px;">3 </a> <a href="http://www.sohu.com/2" style="margin- right:5px;">下一页 </a> <a href="http://www.sohu.com/4" style="margin-right:5px;">末页 </a>
</div>
<div id="Pager" style="text-align:right;">
<a disabled="disabled" style="margin-right:5px;">首页 </a> <a disabled="disabled" style="margin-right:5px;">上一页 </a> <span style="margin-right:5px;font-weight:Bold;color:red;">1 </span> <a href="javascript:__doPostBack('Pager','2')" style="margin- right:5px;">2 </a> <a href="javascript:__doPostBack('Pager','3')" style="margin-right:5px;">3 </a> <a href="javascript:__doPostBack('Pager','2')" style="margin- right:5px;">下一页 </a> <a href="javascript:__doPostBack('Pager','4')" style="margin-right:5px;">末页 </a>
</div>
<!-- AspNetPager V7.0.2 for VS2005 & VS2008 End --> 要求:移除外层的div,将javascript:__doPostBack('Pager','2')替换成诸如:http://www.sohu.com/2
结果:
<div id="Pager" style="text-align:right;">
<a disabled="disabled" style="margin-right:5px;">首页 </a> <a disabled="disabled" style="margin-right:5px;">上一页 </a> <span style="margin-right:5px;font-weight:Bold;color:red;">1 </span> <a href="http://www.sohu.com/2" style="margin- right:5px;">2 </a> <a href="http://www.sohu.com/3" style="margin-right:5px;">3 </a> <a href="http://www.sohu.com/2" style="margin- right:5px;">下一页 </a> <a href="http://www.sohu.com/4" style="margin-right:5px;">末页 </a>
</div>
解决方案 »
- WPF没有找到tabControl的tabitem在选中时的事件
- 使用WeifenLuo.WinFormsUI.Docking.dll 如何判断窗体已经被打开
- 获取excel单元格值出问题
- ASP.NET里面如何判定页面是否加载完成?????????????
- winform程序,为什么与数据库绑定的文本框内容并没有修改但HasChanges()==true?
- 数组中内容按重复次数排序,并去除重复数
- 怎么在word文档中实现保留修改痕迹的作用!急啊
- 数据集填充Excel表格时,如何使重复的值不显示?
- c#如何生成ini文件,并且设置属性为(只读),如何读取ini文件
- 初学者的问题。。
- 关于取得datagridview1里的数据的计算问题
- .net 网站 .aspx页面中的 javascript怎么缩进
string output = Regex.Replace(input,"(?is)(?<=<(a)\b.*?(href)="")javascript:__doPostBack","http://www.sohu.com/2 ");参考
result = Regex.Replace(result, @"(?i)javascript:__doPostBack\('Pager','(\d+)'\)", @"http://www.sohu.com/$1");
richTextBox2.Text = result;
result = Regex.Replace(yourStr, @"(?i)<!--\s*AspNetPager[^>]*>", "");将javascript:__doPostBack('Pager','2')替换成诸如:http://www.sohu.com/2
result = Regex.Replace(result, @"(?i)javascript:__doPostBack\('Pager','(\d+)'\)", @"http://www.sohu.com/$1");
顶,过客。。
这个是忽略大小写的匹配模式,在.NET中,等价于RegexOptions.IgnoreCase参数
查找:javascript:__doPostBack[ ]*\('Pager','?'\)
替换为:http://www.sohu.com/%04
假设原始文件为:
<div id="Pager" style="text-align:right;">
<a disabled="disabled" style="margin-right:5px;">首页 </a> <a disabled="disabled" style="margin-right:5px;">上一页 </a> <span style="margin-right:5px;font-weight:Bold;color:red;">1 </span> <a href="javascript:__doPostBack('Pager','2')" style="margin- right:5px;">2 </a> <a href="javascript:__doPostBack('Pager','3')" style="margin-right:5px;">3 </a> <a href="javascript:__doPostBack ('Pager','4')" style="margin-right:5px;">4 </a> <a href="javascript:__doPostBack('Pager','2')" style="margin- right:5px;">下一页 </a> <a href="javascript:__doPostBack('Pager','4')" style="margin-right:5px;">末页 </a>
</div>将被转换为:
<div id="Pager" style="text-align:right;">
<a disabled="disabled" style="margin-right:5px;">首页 </a> <a disabled="disabled" style="margin-right:5px;">上一页 </a> <span style="margin-right:5px;font-weight:Bold;color:red;">1 </span> <a href="http://www.sohu.com/2" style="margin- right:5px;">2 </a> <a href="http://www.sohu.com/3" style="margin-right:5px;">3 </a> <a href="http://www.sohu.com/4" style="margin-right:5px;">4 </a> <a href="http://www.sohu.com/2" style="margin- right:5px;">下一页 </a> <a href="http://www.sohu.com/4" style="margin-right:5px;">末页 </a>
</div>