var text = "你上面的数据<html>\r\n<head>...";
var newText = text.replace(/^[\s\S]*<html>/,"<html>");
alert(newText); // <html>
// <head>
解决方案 »
- JavaScript提交表单时提示“不支持此属性或方法”
- 关于SVG格式在IE上的显示
- 大家写JQUERY一般用什么啊 ?
- 去除字符串最后一个字符
- IE7中使用window.open是否有参数modal=yes|no
- meizz(梅花雪) 问一下你的一段代码问题
- 一个很奇怪的问题
- ********JavaScript中add是关键字吗?为什么我的input出错?
- 请问如何用一个链接"< a>test</a>" 提交表单?用< a onClick="form1.submit()">t</a>不行呀!?
- JSP与JAVASCRIPT交互问题,如何实现?急死了,各位帮帮忙吧!
- ajax返回的时候的问题
- js如何执行外部html文件
<html>
<head>
...
</html>
<ttt>
那有如何去除<html></html> 之外 的所有字符串呢,因为他们都不固定,是返回值,谢谢了
+ "<html>"
+"<head>"
+"..."
+"</html>"
+"<ttt> ";
alert("原字符串="+str);
str = str.substring(str.indexOf("<html>"),str.indexOf("</html>")+7);
alert("目标字符串="+str);
找猎头把自己卖个好价钱!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<script language="JavaScript">
window.onload=function(){
var o=document.getElementById("text1");
alert(o.value.replace(/^(.|\s)*?(?=\<html\>)/gm,""));
}
</script>
<body>
<textarea id="text1" rows="20" cols="50" wrap="off">HTTP/1.1 200 OK
Connection: close
Date: Mon, 29 Dec 2008 06:38:41 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-Powered-By: PHP/5.1.4
Content-type: text/html<!--Array
(
[txtDepDate] => 2008-12-30
[txtDepPort] => SHA
[txtArrPort] => DLC
[txtAirways] => ALL
[search_number] => 1
)
--> <br />
<b>Notice </b>: Undefined index: txtBackDate in <b>E:\web\ibe\ibe_service\index.php </b> on line <b>68 </b> <br />
<br />
<b>Notice </b>: Undefined index: radio in <b>E:\web\ibe\ibe_service\index.php </b> on line <b>71 </b> <br />
<html>
<head></textarea>
</body>
</html>