JS加ASP二級域名轉(zhuǎn)向的代碼
更新時間:2007年05月17日 00:00:00 作者:
自己做了asp的二級域名轉(zhuǎn)向已經(jīng)使用當(dāng)中,但用到另一種方法:前臺JS加ASP的轉(zhuǎn)向程序卻轉(zhuǎn)不了,程序調(diào)試已經(jīng)通過但不能轉(zhuǎn)向不知道為什么請幫忙指出原因,謝謝?。?!
<%
Dim whkDbq,whkSql,whkRs,whkCount
Set whkConn = Server.CreateObject("ADODB.Connection")
whkDbq = Server.MapPath("SqlTaoFun.mdb")
whkConn.Open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&whkDbq
whkSql = "select bh,id from UserInfo where State='3'"
Set whkRS = Server.CreateObject("ADODB.Recordset")
whkRs.open whkSql,whkConn,3,3
%>
<script language="javascript">
var records = [],whkCoun = 0,whkFlag = 0;
<%
Do while not whkRs.Eof
%>
records[whkCoun] = new Array("<%=whkRs("bh")%>","<%=whkRs("id")%>");
document.write("whkCoun:"+whkCoun+" records["+whkCoun+"]:"+records[whkCoun][0]+records[whkCoun][1]+"<br>");
whkCoun = whkCoun + 1;
<%
whkRs.MoveNext
'whkConn = whkConn + 1
Loop
'Response.End()
%>
whkUrl = document.location.href;
document.write(whkUrl)
whkUrl = whkUrl.replace("http://","");
whkUrl = whkUrl.substring(0,whkUrl.indexOf("/"));
document.write("<br>whkUrl:"+whkUrl);
if (whkUrl.toLowerCase() != "www.taofun.cn")
{
var whkFirstP = whkUrl.indexOf("."),whkEndP = whkUrl.lastIndexOf("."),gotoUrl;
if ((whkFirstP == whkEndP) && ((whkFirstP != -1) || (whkEndP != -1)))
{
whkFlag = 0;
window.alert("taofun.cn");
//window.location.href = "http://www.taofun.cn/"
}
else
{
if (whkUrl == "localhost")
{
whkFlag = 0;
window.alert("localhost");
}
else
{
var whkUrl2 = whkUrl.substring(0,whkUrl.indexOf("."));
document.write("<br>whkUrl2:"+whkUrl2);
if (whkUrl2.toLowerCase() == "www")
{
if (whkUrl.indexOf(".",whkFirstP+1) == whkUrl.lastIndexOf(".",whkEndP-1))
for(i=0;i<whkCoun;i++)
{
document.write("<br>這里是讀取的bh:"+records[i][0]);
if (records[i][0] == whkUrl.substring(whkFirstP+1,whkUrl.indexOf(".",whkFirstP+1)))
{
whkFlag = 1;
gotoUrl = "http://www.taofun.cn/show/Shop.asp?id="+records[i][1];
window.alert("找到"+records[i][0]+"的二級域名。");
break;
}
}
else
{
whkFlag = 0;
window.alert("輸?shù)奶嗔耍?);
//window.location.href = "http://www.taofun.cn/";
}
}
else
{
whkFlag = 0;
window.alert("開頭請輸www");
//window.location.;
}
}
}
}
else
{
whkFlag = 0;
window.alert("去網(wǎng)站首頁!");
//window.location.href = whkUrl;
}
document.write("<br>最后結(jié)果:"+gotoUrl+whkwhkwhk);
if (whkFlag == 1)
{
document.write("<frameset cols=\"*\"><frame frameborder=\"0\" scrolling=\"auto\" src=\""+gotoUrl+"\"><\/frameset>" );
}
</script>
<%
Dim whkDbq,whkSql,whkRs,whkCount
Set whkConn = Server.CreateObject("ADODB.Connection")
whkDbq = Server.MapPath("SqlTaoFun.mdb")
whkConn.Open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&whkDbq
whkSql = "select bh,id from UserInfo where State='3'"
Set whkRS = Server.CreateObject("ADODB.Recordset")
whkRs.open whkSql,whkConn,3,3
%>
<script language="javascript">
var records = [],whkCoun = 0,whkFlag = 0;
<%
Do while not whkRs.Eof
%>
records[whkCoun] = new Array("<%=whkRs("bh")%>","<%=whkRs("id")%>");
document.write("whkCoun:"+whkCoun+" records["+whkCoun+"]:"+records[whkCoun][0]+records[whkCoun][1]+"<br>");
whkCoun = whkCoun + 1;
<%
whkRs.MoveNext
'whkConn = whkConn + 1
Loop
'Response.End()
%>
whkUrl = document.location.href;
document.write(whkUrl)
whkUrl = whkUrl.replace("http://","");
whkUrl = whkUrl.substring(0,whkUrl.indexOf("/"));
document.write("<br>whkUrl:"+whkUrl);
if (whkUrl.toLowerCase() != "www.taofun.cn")
{
var whkFirstP = whkUrl.indexOf("."),whkEndP = whkUrl.lastIndexOf("."),gotoUrl;
if ((whkFirstP == whkEndP) && ((whkFirstP != -1) || (whkEndP != -1)))
{
whkFlag = 0;
window.alert("taofun.cn");
//window.location.href = "http://www.taofun.cn/"
}
else
{
if (whkUrl == "localhost")
{
whkFlag = 0;
window.alert("localhost");
}
else
{
var whkUrl2 = whkUrl.substring(0,whkUrl.indexOf("."));
document.write("<br>whkUrl2:"+whkUrl2);
if (whkUrl2.toLowerCase() == "www")
{
if (whkUrl.indexOf(".",whkFirstP+1) == whkUrl.lastIndexOf(".",whkEndP-1))
for(i=0;i<whkCoun;i++)
{
document.write("<br>這里是讀取的bh:"+records[i][0]);
if (records[i][0] == whkUrl.substring(whkFirstP+1,whkUrl.indexOf(".",whkFirstP+1)))
{
whkFlag = 1;
gotoUrl = "http://www.taofun.cn/show/Shop.asp?id="+records[i][1];
window.alert("找到"+records[i][0]+"的二級域名。");
break;
}
}
else
{
whkFlag = 0;
window.alert("輸?shù)奶嗔耍?);
//window.location.href = "http://www.taofun.cn/";
}
}
else
{
whkFlag = 0;
window.alert("開頭請輸www");
//window.location.;
}
}
}
}
else
{
whkFlag = 0;
window.alert("去網(wǎng)站首頁!");
//window.location.href = whkUrl;
}
document.write("<br>最后結(jié)果:"+gotoUrl+whkwhkwhk);
if (whkFlag == 1)
{
document.write("<frameset cols=\"*\"><frame frameborder=\"0\" scrolling=\"auto\" src=\""+gotoUrl+"\"><\/frameset>" );
}
</script>
相關(guān)文章
JavaScript字符串_動力節(jié)點Java學(xué)院整理
JavaScript中的字符串就是用''或""括起來的字符表示。下面通過本文給大家介紹JavaScript字符串的相關(guān)知識,感興趣的朋友一起看看吧2017-06-06BootStrap實現(xiàn)帶有增刪改查功能的表格(DEMO詳解)
這篇文章主要介紹了BootStrap實現(xiàn)帶有增刪改查功能的表格,表格封裝了3個版本,接下來通過本文給大家展示下樣式及代碼,對bootstrap增刪改查相關(guān)知識感興趣的朋友一起通過本文學(xué)習(xí)吧2016-10-10微信小程序 bindtap 事件多參數(shù)傳遞的代碼示例
在微信小程序中,我們無法直接通過 bindtap="handleClick(1,2,3)" 的方式傳遞參數(shù),而是通過自定義屬性data- 的方式傳遞,并在事件回調(diào)函數(shù)中通過event.currentTarget.dataset獲取這些參數(shù),本文給大家介紹小程序 bindtap 事件多參數(shù)傳遞的實例代碼,感興趣的朋友一起看看吧2023-12-12