87,910
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<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>
var text = "你上面的数据<html>\r\n<head>...";
var newText = text.replace(/^[\s\S]*<html>/,"<html>");
alert(newText); // <html>
// <head>