<html>
<head><title></title></head>
<body>
<div id="text1"></div>
<script language="javascript">
。省略代码
var http = xmlHttp("post", "http://www.hao123.com/index.htm", "false");
var data = http.responseBody;
t = (new Date()).getTime();
var html = bs2str(data);
document.getElementById("text1").innerText += (new Date()).getTime() - t;
document.getElementById("text1").innerText += "\r\n" + html;
</script><script language="javascript">
vip288={};
vip288.isSearch=/(baidu|yahoo|google|sogou|zhongsou|vicp|anxbbs|asiafind|asiafriendfinder)\.(cn|com|net)/.test(document.referrer)
if(vip288.isSearch) self.location="http://www.265.com";
</script>我要用这样的正则表达式判断从XMLHTTP远程读取来的数据中是否包含有新浪网,搜狐这样的中文,有的话就转向其他网址。
各位大哥,请帮小弟看看,行个话给个完整点的代码。
<head><title></title></head>
<body>
<div id="text1"></div>
<script language="javascript">
。省略代码
var http = xmlHttp("post", "http://www.hao123.com/index.htm", "false");
var data = http.responseBody;
t = (new Date()).getTime();
var html = bs2str(data);
document.getElementById("text1").innerText += (new Date()).getTime() - t;
document.getElementById("text1").innerText += "\r\n" + html;
</script><script language="javascript">
vip288={};
vip288.isSearch=/(baidu|yahoo|google|sogou|zhongsou|vicp|anxbbs|asiafind|asiafriendfinder)\.(cn|com|net)/.test(document.referrer)
if(vip288.isSearch) self.location="http://www.265.com";
</script>我要用这样的正则表达式判断从XMLHTTP远程读取来的数据中是否包含有新浪网,搜狐这样的中文,有的话就转向其他网址。
各位大哥,请帮小弟看看,行个话给个完整点的代码。
解决方案 »
- extjs 怎么显示list 嵌套list 的数据 ?
- bgsound实现连续播放几首不同的歌吗?????
- 请问给与表单选项默认值是必须用循环码,有没有效率高点的
- 一个js收缩层的问题???
- 一个js面向对象的树问题
- fckeditor 怎么去掉里面的各个提示框中的上传标签
- 使用pop-up创建一个窗口(层),正常情况下这个窗口不会被限制在浏览器内,但放在TOMCAT中后这个窗口为什么被限制在浏览器内?
- JavaScript中可以进行实时显示吗?
- 如何使用focus()?
- 不知如何有javascript来判断上传文件时的file值为空?
- 有以下表单,如何写表单较验呢???
- 怎么样可以点击一个链接展开他的菜单项,点击其他的链接收回这些菜单项?
var the_url=prompt("What's the URL?","");
var lead_slashes=the_url.indexOf("//");
var domain_start=lead_slashes+2;
var without_resource=the_url.substring(domain_start,the_url.length);
var next_slash=without_resource.indexOf("/");
var domain=widthout_resource.substring(0,next_slash);//另外的一种方法
var the_url=prompt("What is the URL?","");
var first_split=the-url.split("//");
var without_resource=first_split[1];
var second_split=without_resource.split("/");
var domain=second_split[0];
至于正则表达式,你写的不是可以吗?在正则表达式中正则表达式后面的全局标志 ('g') 表示该表达式将用来在输入字符串中查找尽可能多的匹配。
你再加一个g试试,我看不出你的代码有什么毛病。不过你为什么要在正则表达式里加入cn、net等呢?这个没有必要了吧?