“JavaScript/Dom” 相关主题的文章存档:

文本方式实现同一 IP 端口绑定不同域名

本站曾经介绍过在IIS 中设置主机头,实现 “在一个IP的一个端口下,不同的来访域名对应到到不同的主机” 的方法。今天再给大家介绍几种通过ASP 或JS 实现多个域名使用一个主机放置不同的站点的方法,如下面所示:

用ASP方法实现:

1、
<%
if Request.ServerVariables("SERVER_NAME")="www.alli.cn" then
response.redirect "index.htm"
elseif Request.ServerVariables("SERVER_NAME")="blog.alli.cn" then
response.redirect "blog"
elseif Request.ServerVariables("SERVER_NAME")="album.alli.cn" then
response.redirect "album"
end if
%>

2、
<%
if Request.ServerVariables("SERVER_NAME")="www.alli.cn" then
Server.Transfer("index.htm")
elseif Request.ServerVariables("SERVER_NAME")="blog.alli.cn" then
Server.Transfer("blog")
elseif Request.ServerVariables("SERVER_NAME")="album.alli.cn" then
Server.Transfer("album")
else
Server.Transfer("index.htm")
end if
%>

3、
<%
if instr(Request.ServerVariables("SERVER_NAME"),"www.alli.cn")>0 then
response.redirect "index.htm"
elseif instr(Request.ServerVariables("SERVER_NAME"),"blog.alli.cn")>0 then
response.redirect "blog"
elseif instr(Request.ServerVariables("SERVER_NAME"),"album.alli.cn")>0 then
response.redirect "album"
end if
%>

4、
<%
select case request.servervariables("http_host")
case "www.alli.cn" '1
Server.Transfer("index.htm")
case "blog.alli.cn" '2
Server.Transfer("blog")
case "album.alli.cn" '3
Server.Transfer("album")
...... 继续添加 ......
end select
%>

具体做法:
将需要做转向的域名指向到你的空间的IP.
建立默认首页的asp 文件, 将代码添加到文件的头部.
上传就 OK 了!

用JS方法实现:

在空间的默认首页面建立文件如:default.htm

<html>
<script language="javascript">
if(this.location=="http://alli.cn/")
{this.location.href="http://alli.cn/index.htm";}
else
if(this.location=="http://www.alli.cn/")
{this.location.href="http://www.alli.cn/index.htm";}
else
if(this.location=="http://blog.alli.cn/")
{this.location.href="http://www.alli.cn/blog/";}
else
if(this.location=="http://album.alli.cn/")
{this.location.href="http://www.alli.cn/album/";}
else
if(this.location=="http://wap.alli.cn/")
{this.location.href="http://www.alli.cn/wap/";}
else
{this.location.href="http://www.alli.cn/index.htm";}
</script>
</html>

关于Logo链接图片404错误的处理方法

关于Logo链接404错误的处理方法

相信好多网站的友情链接页面中都有由于连接超时而显示不出来的Logo图片,看上去一块块打上去的补丁很不雅观,下面我就教大家一种简单实用的解决方法,用自己的设定默认图标来替代这些补丁的方法。 感兴趣?继续阅读 »

双击鼠标滚动屏幕的代码

uploads/200509/10_095856_eb4h6.gif

将下面的代码复制到<body></body>之间,就可以在网页实现双击鼠标左键滚动屏幕了! 感兴趣?继续阅读 »

脚本转换 ASCII 码生成器

uploads/200509/01_011451_urkyascii.gif

生成器源码 (Unicode编码) 如下: 感兴趣?继续阅读 »