在html頁面用ajax的簡單應用通過javascript得到資料庫中的圖片路徑並在表格中顯示出來
阿新 • • 發佈:2019-02-02
<%@ Language=VBScript %>
<!-- #INCLUDE FILE="connectdb.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312 "/>
<title>無標題文件</title>
</head>
<body>
<%
userId=Request.QueryString("userid")
set rs=server.CreateObject("adodb.recordset")
sqlcmd="select top 1* from oa_user_photo where PhotoTypeId=1 and UserId="&userId&"order by Id ASC"
rs.open sqlcmd,conn,1,1
path=replace(rs("PhotoPath "),"photo/","")
f2 = server.MapPath("../photo")&path
Response.Write("<img src='"&f2&"' width='150' height='200'>")
rs.close
conn.close
%>
</body>
</html>
<!-- #INCLUDE FILE="connectdb.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312
<title>無標題文件</title>
</head>
<body>
<%
userId=Request.QueryString("userid")
set rs=server.CreateObject("adodb.recordset")
sqlcmd="select top 1* from oa_user_photo where PhotoTypeId=1 and UserId="&userId&"order by Id ASC"
rs.open sqlcmd,conn,1,1
path=replace(rs("PhotoPath
f2 = server.MapPath("../photo")&path
Response.Write("<img src='"&f2&"' width='150' height='200'>")
rs.close
conn.close
%>
</body>
</html>