关闭

一段歪曲了概念的脚本,JS怎么能读服务器上的数据库呢??

1147人阅读 评论(0) 收藏 举报

<select size="1" name="location" onChange="changelocation(document.Form1.location.value)"  language="JavaScript">   
             <option value="US" >US Server </option>
             <option value="EURO">EU Server</option>
         </select>
<span id="SvrName">
<select size="1" width="10" name="ServerName" id="ServerName" >
<option value="">Select Your Server</option>                 
</select>
</span>  
   <script language ="JavaScript">
function changelocation(location)
{
var StringSvrName;
var StrSelect;
var SqlString;
SqlString="Select * from GoldPrice where Location='"+location+"' and Faction='Alliance' Order By ServerName,Faction";
alert(SqlString);
StrSelect="<option value=''>Select Your Server</option>";
<%
Set conn = Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft Access Driver (*.mdb)}; "
Strconn=Strconn & "DBQ=" & Server.MapPath("../../database/gamesavornews.mdb")
conn.Open Strconn
set rs=server.CreateObject("adodb.recordset")
sql="Select * from GoldPrice where Faction='Alliance' Order By ServerName,Faction"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
%>
StrSelect=StrSelect+"<option value=''>No Server</option>";
<%
else
for i=1 to rs.recordcount
%>
StrSelect=StrSelect+"<option value='<%=replace(rs("ServerName"),"'","''")%>' ><%=replace(rs("ServerName"),"'","''")%></option>";
<%
rs.movenext
next
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%> 
StringSvrName="<select size='1' width='10' name='ServerName' id='ServerName'>";       
StringSvrName=StringSvrName+StrSelect;
StringSvrName=StringSvrName+"</select>";
document.all.SvrName.innerHTML=StringSvrName;
alert(StrSelect);
}
</script>
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1278620次
    • 积分:15013
    • 等级:
    • 排名:第788名
    • 原创:292篇
    • 转载:60篇
    • 译文:2篇
    • 评论:177条
    文章存档
    最新评论
    C#+Jquery
    C#+Jquery