日期:2014-05-16  浏览次数:20673 次

问个ajax中问题 - Web 开发 / Ajax
求个实例,内容如下:
prototype的ajax中实现当Ajax.Request的时候出现一个提示查询动画,且该动画一出现的时候,该页面变灰色,什么地方均不可以点击;直到该ajax.request查询到所要求的数据后页面恢复原来的可点击状态

万分感谢!!

------解决方案--------------------
这个就是“lightbox”了
在百度上一搜就有大量的代码,你看需要哪个吧
比如
http://particletree.com/examples/lightbox/
上面是可以下载到源代码的最后那个例子和你要的基本一致
------解决方案--------------------
下面是使页面边灰色的代码,不过没用过prototype,不知道怎么处理状态,你可以在ajaxobj.readyState==4时把iframe隐藏掉,在ajaxobj.send后显示iframe

HTML code
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>

<body style="margin:0;">
<select><option >test</option></select>
<input> 
<input type=button value="点击将页面灰掉" onclick="disableBodyArea();"> 
<br><br><br><br>
<br><br><br><br>
<select><option >test</option></select>
<br><br><br><br>
<br><br><br><br>
<select><option >test</option></select>
<br><br><br><br>
<br><br><br><br>
</body>

</html>
<script>
//这里初始化遮盖面的,使用IFRAME
window.onload=function()
  {
     var iframe=document.createElement("iframe");
     iframe.id="mark";
     iframe.style.display='none';
     iframe.style.position='absolute';
     iframe.style.top='0px';
     iframe.style.left='0px';
     iframe.style.margin='0px';
     iframe.style.width='100%';
     iframe.style.height='100%';
     iframe.style.backgroundColor='#666666';
     iframe.style.zIndex=100;
     iframescrolling="no";
     iframe.frameborder="0";
     if(document.all)//ie
       iframe.style.filter="Alpha(opacity=60)";
     else
       iframe.style.opacity="0.6";
     document.body.appendChild(iframe);      
  }
function disableBodyArea(){
    document.getElementById("mark").style.display=""
}

</script>