底子薄,还请高手帮忙?
调用后台数据库表中的图片(路径),打开页面时就任意显示一张图片在页面DIV ID=ID6中,点击按钮“NO" 就换另外一张图片,再点又换一张,按其他方法做了一个,页面显示有问题,请帮忙改正,谢谢。
AJAX:
HTML部分:
后台:
matchwith.asp
AJAX:
<script type="text/javascript">
var xmlhttp;
function displayImage() {
var str
if (window.XMLHttpRequest) {
//针对FireFox,Mozillar,Opera,Safari,IE7,IE8
xmlhttp = new XMLHttpRequest();
//针对某些特定版本的mozillar浏览器的BUG进行修正
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType("text/xml");
}
} else if (window.ActiveXObject) {
var activexName = ["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
for (var i = 0; i < activexName.length; i++) {
try{
xmlhttp = new ActiveXObject(activexName[i]);
break;
} catch(e){
}
}
}
if (!xmlhttp) {
alert("XMLHttpRequest对象创建失败!!");
return;
}
xmlhttp.onreadystatechange = callback;
xmlhttp.open("GET","matchwith.asp?str="+'&n='+Math.random(),true);
xmlhttp.send(null);
}
var i = 0;
var max_i = 10;
function callback()
{
if (xmlhttp.readyState == 4) {
//判断http的交互是否成功
if (xmlhttp.status == 200) {
//获取服务漆器端返回的数据
var divNode = document.getElementById("id6");
var img = div.getElementsByTagName("imghtml");
if (img.length == 0) {
img = document.createElement("imghtml");
while (div.childNodes.length > 0)
div.removeChild(div.childNodes[0]);
div.appendChild(img);
} else
img = img.item(0);
img.src = str;
if (i == max_i)
i = 0;
else
i ++;
divNode.innerHTML = responseText;
});
}
</script>HTML部分:
<body onload="displayImage()">
<input style="position:absolute; float:left; background:#0099FF; font-family:Arial, Helvetica, sans-serif; color:#CC3366; left: 610px; top: 120px;width:30px;" type="button" value="No" onclick="displayImage()">
<div id="id6"><img class="imghtml" src="" width="250" height="264" /></div>后台:
matchwith.asp
<!--#include file="conn/conn.asp"-->
<%
dim Gender1,age1,age2,country,drrTmp
Gender1=request.Form("Gender")
age1=request.Form("age1")
age2=request.Form("age2")
country=request.Form("country")
set rs=server.createobject("adodb.recordset")
sql="select Username,Gender,age,Country from customer1 where Gender='"&Gender1&"'and (age BETWEEN "&age1&" and "&age2&") and Country ='"&country&"'"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write("no one match with you want! please try again!")
else
for i=1 to rs.recordcount
if rs.eof then
exit for
end if
drrTmp=drrTmp&rs("Username")&","
session("eeee")=drrTmp
rs.movenext
next
end if
%>
<%
dim hrrTmp
hrrTmp=replace(session("eeee"),",","','")
set rs=server.createobject("adodb.recordset")
sql="select ID,USERNAME,PICPATH from ladlady where USERNAME in ('"&hrrTmp&"')"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.Write("no photo!")
else
Do while not rs.eof
str=rs("PICPATH")
rs.movenext
loop
end if
rs.close
set rs = nothing
str=escape(str)
Response.Write str
set conn=nothing
%>
...全文
相关推荐
学生底子薄基础差培养机制精选.doc
学生底子薄基础差培养机制精选.doc
学生底子薄基础差培养机制.doc
学生底子薄基础差培养机制.doc
高职院校《高等数学》课程教学改革探讨 (2011年)
阐述了目前高职院校《高等数学》课程教学现状,认为高职院校学生基础差、底子薄和教学手段落后等是目前该课程教学中存在的主要问题。提出了高职院校《高等数学》课程的教学改革措施,即培养学生的学习兴趣、坚持“必须、够用”的原则精选教学内容、通过强化课堂互动教学鼓励学生勤于思考、充分利用多媒体课件(CAI)进行辅助教学。教学实践表明,采取上述改革措施可以提高高职院校《高等数学》课程教学质量。
班务管理心得体会.doc
班务管理心得体会.doc
高三英语一轮复习计划(精选4篇).pdf
高三英语一轮复习计划(精选4篇).pdf


