innerHTML被IE自动加上了很多回车,标签也被转换成大写,
你alert(bd)一下就知道了;
你alert(bd)一下就知道了;
解决方案 »
- IE8下用JQUERY的HIDE方法以后DIV的MARGIN失效!
- 给定一个日期,js如何判别这个日期是否为给定月的最后一天呢,比如说给定日期是2007-01-31那么用js判别31号是否为2007年1月的最后一天呢
- 提取网页图片的更多信息!??
- 2005年的最后一个难题~~
- 怎么把这样的格式 按指定要求输出?
- 50分请教如何将现有QQ菜单修改为无图片得滑动菜单?见源码
- [求助]<a href="ProjectLayout_Query.aspx?QueryType='+document.all('ip_hid_QueryType').value">错在哪里?
- 急救!一个简单问题。在线等待!
- 进来看看这是什么问题?
- 动态设置背景图片的position
- JScript将字符串编译成URL的语句是什么?
- 想实现这样的效果,在一个文本框中输入内容,当时去焦点时,马上能判断输入是否为空,为空的话,马上在文本框下面显示提示信息“输入不可
textarea是用来测试的。我想取下面括号内的内容,我记得jscript支持m多行查找模式的阿。
可是为什么/.*vwriter=aaa201.*/igm; 也不行<table ...>....vwriter=aaa201...</table>
....
....
<table
pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配,也就是说,该匹配不需要获取供以后使用。例如'Windows
(?!95|98|NT|2000)' 能匹配 "Windows 3.1" 中的 "Windows",但不能匹配 "Windows 2000" 中的 "Windows"。预查不消耗字
符,也就是说,在一个匹配发生后,在最后一次匹配之后立即开始下一次匹配的搜索,而不是从包含预查的字符之后开始
我也在弄了好久了,我想这个应该可以实现啊,但是就是不成功
function getReply()
{
re =/<(table)(.+?)(vwriter=aaa201)(.*?)<\/\1>/ig;
bd=document.body.innerHTML.replace(/\n/g,'');
alert(bd)
alert(bd.match(re))o=document.getElementById('info');
o.value=bd.match(re);
}
</script><input type="button" value="ddd" onclick="getReply();" />
<textarea name="" id="info" rows="10" cols="80" >
</textarea><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa201</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br>
<TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa201</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br>
re =/<table.*?>.*?vwriter=aaa201.*?<\/table>/ig;bd=document.body.innerHTML.replace(/\n/g,'');这个不准确,会将中间不需要的也取了来。以下是test.
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>
*{ font-family: "宋体"; font-size: 12px;}
</STYLE>
<script>
function getReply()
{re =/<table[^\x04]*?>[^\x04]*?vwriter=aaa201[^\x04]*?<\/table>[^\x04]*?<table/igm;
bd=document.body.innerHTML;
re =/<(table).*?>.*?vwriter=aaa201.*?<\/\1>/ig;
re =/<table.*?>.*?vwriter=aaa201.*?<\/table>/ig;bd=document.body.innerHTML.replace(/\n/g,'');
r='';
while ((arr = re.exec(bd)) != null)
r += bd.substring( arr.index , arr.lastIndex )+"\n------------------------\n";o=document.getElementById('info');
o.value=r;
//alert(bd);
}</script>
</HEAD>
<BODY bgcolor="#F5F9FA" rightMargin=50 leftMargin=50 topMargin=8 class="body" id="tech_body"
>
<input type="button" value="ddd" onclick="getReply();" />
<textarea name="" id="info" rows="10" cols="80" >
</textarea>
<TITLE>xx</TITLE>
<DIV class=content style="WORD-WRAP:break-word">
<font color=#DC143C>刷屏,封ID/飘影</font><br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa201</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa201</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa301&idwriter=0&key=0" target=_blank>aaa301</a> 回复日期:2006-3-22 00:00:03</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 想要朝挖坑专业方向发展的,瞧瞧,好好学学<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa401&idwriter=0&key=0" target=_blank>aaa401</a> 回复日期:2006-3-22 00:00:38</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 睡觉了 888 各位<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=深蓝酒魔&idwriter=0&key=0" target=_blank>深蓝酒魔</a> 回复日期:2006-3-22 00:00:39</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 你个SB,么JB本事,只会挖坑<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa201</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=年轻的心123&idwriter=0&key=0" target=_blank>年轻的心123</a> 回复日期:2006-3-22 00:04:19</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 对挖坑的真的无语了!!!<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa201</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br>
</body></html>
这样可以取出来,但是不需要的也在里面
终于搞定了,郁闷了好久呀!爽!
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>
*{ font-family: "宋体"; font-size: 12px;}
</STYLE>
<script>
function getReply()
{
bd=document.body.innerHTML;re =/<table[^>]*>(([^\x04](?!<\/table>))*?)vwriter=aaa201(([^\x04](?!<\/table>))*?)[^\x04]<\/table>(([^\x04](?!<\/table>))*?)(?=<table|<\/div)/ig;
alert(bd.match(re));
o=document.getElementById('info');
o.value=bd.match(re);
alert(bd.match(re).length);
}</script>
</HEAD>
<BODY bgcolor="#F5F9FA" rightMargin=50 leftMargin=50 topMargin=8 class="body" id="tech_body"
>
<input type="button" value="ddd" onclick="getReply();" />
<textarea name="" id="info" rows="10" cols="80" >
</textarea>
<TITLE>xx</TITLE>
<DIV class=content style="WORD-WRAP:break-word">
<font color=#DC143C>刷屏,封ID/飘影</font><br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa2011</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa2012</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa301&idwriter=0&key=0" target=_blank>aaa301</a> 回复日期:2006-3-22 00:00:03</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 想要朝挖坑专业方向发展的,瞧瞧,好好学学<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa401&idwriter=0&key=0" target=_blank>aaa401</a> 回复日期:2006-3-22 00:00:38</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 睡觉了 888 各位<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=深蓝酒魔&idwriter=0&key=0" target=_blank>深蓝酒魔</a> 回复日期:2006-3-22 00:00:39</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 你个SB,么JB本事,只会挖坑<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa2013</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=年轻的心123&idwriter=0&key=0" target=_blank>年轻的心123</a> 回复日期:2006-3-22 00:04:19</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 对挖坑的真的无语了!!!<br><TABLE cellspacing=0 border=0 bgcolor=f5f9fa width=100% ><TR><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom></TD><TD><font size=-1 color=green><br><center>作者:<a href="/browse/Listwriter.asp?vwriter=aaa201&idwriter=0&key=0" target=_blank>aaa2014</a> 回复日期:2006-3-21 23:59:10</font> </center></TD><TD WIDTH=100 ALIGN=RIGHT VALIGN=bottom> </TD></TR></table> 分页沙发<br>
</body></html>
辛苦了,好兄弟。