回 帖 发 新 帖 刷新版面

主题:[求助]大家帮帮忙,保存功能出了问题.

这是交友程序,其中一个文件出了问题,会员在布置套房后,里面的物品(图片)布置后无法保存移动后的位置,虽然提示保存成功,但刷新后,所有的物品又恢复到原来的位置,挤在一块了,请大家帮我修改下程序,谢谢!
程序代码如下:
<!--#include file="const.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%if Session("weight")<0 then 
Response.Redirect "error.asp?cause=4"
end if%>
<%
set rs2=server.CreateObject("adodb.recordset")
sql="select * from room_obj where username='"&Session("Current_user")&"'"
rs2.open sql,conn,1,3
for i=1 to rs2.recordcount
      if DateDiff("d",rs2("endtime"),date)>0 then
         rs2("selected")=0
         rs2("typeid")=5
        rs2.update

      end if
rs2.movenext
next
rs2.close
set rs2=nothing
%>


<SCRIPT LANGUAGE="JavaScript">
<!-- // RightClickMenu

function showmenu(){
        var rightedge=event.clientX
        var bottomedge=event.clientY
        if (rightedge>480)
            ie5menu.style.left=480
        else
            ie5menu.style.left=rightedge+20
        if (bottomedge>480)
            ie5menu.style.top=480
        else
            ie5menu.style.top=bottomedge
        ie5menu.style.visibility="visible"
        return false
}

function showmenu2(){
        var rightedge=event.clientX
        var bottomedge=event.clientY
        if (rightedge>480)
            ie5menu2.style.left=480
        else
            ie5menu2.style.left=rightedge+20
        if (bottomedge>480)
            ie5menu2.style.top=480
        else
            ie5menu2.style.top=bottomedge
        ie5menu2.style.visibility="visible"
        return false
}

// -->
</SCRIPT>

<SCRIPT language=JavaScript>
var cursorX,cursorY,obj=null;
var moveAble=true;
function enableMove(index){
    cursorX=event.clientX;
    cursorY=event.clientY;
    obj=index;
    
}
function img_border(obj){
obj.className="img_border"
}
function no_img_border(obj){
obj.className=""
}

function disableMove() {obj=null;}
function move_ie(){
    if(obj && moveAble){
    
        DIV_name=obj.id;
        moveX=event.clientX;
        moveY=event.clientY;
        if(moveX>550)
        moveX=550;
        if(moveX<10)
        moveX=10;
        if(moveY>480)
        moveY=480;
        if(moveY<10)
        moveY=10;
        document.all[DIV_name].style.posLeft+=moveX-cursorX;
        document.all[DIV_name].style.posTop+=moveY-cursorY;
        cursorX=moveX; 
        cursorY=moveY;
    }
    
}

</SCRIPT>
<%
str="<script type='text/javascript' language='JavaScript1.2'>"& vbcrlf
str=str& " function hidemenuie5() "& vbcrlf
str=str&" { "& vbcrlf

str=str& "ie5menu.style.visibility='hidden'" & vbcrlf
str=str& "ie5menu2.style.visibility='hidden'" & vbcrlf

set rs=server.CreateObject("adodb.recordset")
sql="select * from room_obj where username='"&Session("Current_user")&"' and selected=1 and room_kind=1 order by id desc"
rs.open sql,conn,1,1
for i=1 to rs.recordcount

str=str& "ie5menu"&rs("id")&".style.visibility='hidden'" & vbcrlf
rs.movenext
next
rs.close

str=str&" } "&vbcrlf
str=str&"</script>"&vbcrlf

response.write str


%>
<%
'/////////用asp 生成  SavePos() 以便获得移动物品后的位置//////////////////////////////
str="<script type='text/javascript' language='JavaScript1.2'>"& vbcrlf
str=str& " function SavePos() "& vbcrlf
str=str&" { "& vbcrlf

str=str&"RoomForm.user_left.value=document.all.DIV_user.style.posLeft;"& vbcrlf
str=str&"RoomForm.user_top.value=document.all.DIV_user.style.posTop;"& vbcrlf
'str=str&"RoomForm.user_z.value=document.all.DIV_user.style.z-index;"& vbcrlf


set rs_obj=server.CreateObject("adodb.recordset" )
sql="select * from room_obj where username='"&Session("Current_user")&"' and selected=1 and room_kind=1 order by id desc"
rs_obj.open sql,conn,1,1
for i=1 to rs_obj.recordcount
    str=str&" RoomForm.posleft_"&rs_obj("id")&".value = document.all.DIV_GIFT_"&rs_obj("id")&".style.posLeft "& vbcrlf
    str=str&" RoomForm.postop_"&rs_obj("id")&".value = document.all.DIV_GIFT_"&rs_obj("id")&".style.posTop "& vbcrlf
    
rs_obj.movenext
next
str=str&"RoomForm.friend_left.value=document.all.DIV_friend.style.posLeft;"& vbcrlf
str=str&"RoomForm.friend_top.value=document.all.DIV_friend.style.posTop;"& vbcrlf

str=str&" } "&vbcrlf
str=str&"</script>"&vbcrlf

response.write str
rs_obj.close
set rs_obj=nothing
'////////////////////////////////////////////////////////////////////////////////////////////////////////

回复列表 (共4个回复)

沙发

'////////////////////////////////////////////////////////////////////////////////////////////////////////
%>
<%
'/////////////////////////////////////////////若room 表中没有该人的记录,则系统自动生成一个默认的套房
    '    sql="select love_user.*,room.* from love_user,room where  love_user.username=room.username and love_user.username='"&session("Current_user")&"'"
    sql="select room.* from love_user,room where  love_user.username=room.username and love_user.username='"&session("Current_user")&"'"
        set rs=server.CreateObject("adodb.recordset")
        rs.open sql,conn,1,3
        if rs.eof  then 
           rs.addnew
           rs("username")=session("Current_user")
           rs("room_name")="默认套房"
            rs("room_img")="room_img/BEDROOM_001.gif"
               rs("hits")=0
            rs.update
            
           
          end if
          rs.close
'/////////////////////////////////////////////////////////////////////////////////////////////////////////

'//////////////////////////////////////////////////////取得用户的形象照片及位置///////////////////////////    
        sql="select love_user.*,room.* from love_user,room where  love_user.username=room.username and love_user.username='"&session("Current_user")&"'"
        rs.open sql,conn,1,1

          
        username=rs("username")
        xingxiang=rs("zaoxing_big")
        friend=rs("house_friend")
        pos_left=rs("pos_left")
        pos_top=rs("pos_top")
        pos_z=rs("pos_z")
        pos_FlipH=rs("pos_FlipH")
        pos_gray=rs("pos_gray")
        pos_show=rs("pos_show")
        rs.close
'///////////////////////////////////////////////////////////////////////////////////////////////////
    
'////////////////////////////////////////取出套房背景和背景音乐////////////////////////////////
sql="select Room_url from room_bg where username='"&session("Current_user")&"' and typeid=1 and selected=1"    'typeid=1 表示是背景图片
rs.open sql,conn,1,1
if rs.eof then
room_img="room_img/BEDROOM_001.gif"
else
room_img=rs("Room_url")
end if
rs.close

sql="select url from sound_bg where username='"&session("Current_user")&"' and selected=1"    'typeid=1 表示是背景图片
rs.open sql,conn,1,1
if rs.eof then
bg_sound=""
else
bg_sound=rs("url")
end if
rs.close
'/////////////////////////////////////////////////////////////////////////////////////////////
'///////////////////////////////看住谁那///////////////////////////////////
sql="select * from tongju where user_2='"& Session("Current_user")&"'"
rs.open sql,conn,1,1
if not rs.eof then
zhushuina=rs("zhushuina")
end if
rs.close
'//////////////////////////////////////////////////////////////////////////
'××××××××××××××××找到同居对象的形象照片××××××××××××××××××

if friend <> "0" then
   '  if zhushuina=Session("Current_user") then
      sql="select * from love_user where username='"&friend&"'"
      rs.open sql,conn,1,1
      friend_img=rs("zaoxing_big")
      pos_left_f=rs("pos_left")
        pos_top_f=rs("pos_top")
        pos_z_f=rs("pos_z")
        pos_FlipH_f=rs("pos_FlipH")
        pos_gray_f=rs("pos_gray")
        pos_show_f=rs("pos_show")
        rs.close
  ' end if
'×××××××××××××××××××××××××××××××××××××××××××××
end if
%>
<link rel="stylesheet" href="../css/default.css" type="text/css">
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<SPAN onmousemove=move_ie()  id=RoomSpan style="Z-INDEX: 1; WIDTH: 568px; POSITION: absolute; TOP: 0px; HEIGHT: 600px; left: 1px;">
<% if zhushuina=Session("Current_user") then%><% =username%>--<%=friend%> 的房间<%else%><% =username%> 的房间<%end if%><br>
        <form action="room_set_update.asp" method="post" name="RoomForm" id="RoomForm" target="_blank">
            <table width="568" height="500" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td background="<%=room_img%>"></td>
              </tr>
            </table>
          <p align="center">
            
   <input type="hidden" name="user_left" id="user_left">
<input type="hidden" name="user_top" id="user_top">
<input type="hidden" name="user_z" id="user_z">

            </p>

            <!--  用户的形象照片的显示及位置的控制 -->
                        <%
set rs=server.CreateObject("adodb.recordset")
sql="select sex from love_user where username='"&Session("Current_user")&"'"
rs.open sql,conn,1,1
if rs.eof then
response.write"用户不存在"
response.End()
end if

if rs("sex")="男" then
body_img="suit_images/body_1_m_w_f.gif"
else
body_img="suit_images/body_1_f_w_f.gif"
end if
rs.close
'set rs=nothing
%>
<DIV onmouseup=disableMove(); onmousedown=enableMove(this) ; oncontextmenu="return showmenu()"; onMouseOver=img_border(this); onMouseOut=no_img_border(this); id=DIV_user style="Z-INDEX: 9999; LEFT: <%=pos_left%>px; WIDTH: 80px; POSITION: absolute; TOP: <%=pos_top%>px; <%if pos_FlipH=1 then%>filter:FlipH <%else%> <%end if%> ;  <%if pos_show=1 then%>visibility: visible<%else%> <%end if%> ; HEIGHT: 115px"><div id="main" name="main" style="position: absolute; top:-30px; left:-30px; width: 200px; height: 338;"> <img src="<%=body_img%>" border="0">                        
                  <%
set rs=server.CreateObject("adodb.recordset")

sql = "Select * From suit where username='"&Session("Current_user")&"' and selected=1"
rs.open sql,conn,1,1

if not rs.eof then
%>
<% for i=1 to rs.recordcount

obj_num=rs.recordcount
div_num=obj_num+2          '确定移动量,就是说右键菜单 “移动最前” 的移动量,2表示用户和室友
url=rs("url")
id=rs("id")
%>
<DIV  onmouseup=disableMove(); onmousedown=enableMove(this);  id=DIV_GIFT_<%=rs("id")%> style="Z-INDEX: 0; LEFT: 0px;  POSITION: absolute; TOP:0px;"><IMG src="<%=url%>"> </DIV>
    <%
rs.movenext
next
end if
rs.close
'set rs=nothing
'conn.close
%>
</div></DIV>
<!--  用户的形象照片的显示及位置的控制 结束 -->

<!--  室友形象照片的显示及位置的控制 -->
<% if friend <> "0" then%>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select sex from love_user where username='"&friend&"'"
rs.open sql,conn,1,1
if rs.eof then
response.write"用户不存在"
response.End()
end if

if rs("sex")="男" then
body_img="suit_images/body_1_m_w_f.gif"
else
body_img="suit_images/body_1_f_w_f.gif"
end if
rs.close
'set rs=nothing
%>
<input type="hidden" name="friend_left" id="friend_left">
<input type="hidden" name="friend_top" id="friend_top">

<DIV onmouseup=disableMove(); onmousedown=enableMove(this); oncontextmenu="return showmenu2()" ; onMouseOver=img_border(this); onMouseOut=no_img_border(this); id=DIV_friend style=" Z-INDEX: 9999; LEFT: <%=pos_left_f%>px; WIDTH: 80px; POSITION: absolute; TOP:  <%=pos_top_f%>px; <%if pos_FlipH_f=1 then%>filter:FlipH <%else%> <%end if%> ; <%if pos_show_f=1 then%>visibility: visible<%else%> <%end if%> ;HEIGHT: 115px"><div id="main" name="main" style="position: absolute; top:-30px; left:-30px; width: 200px; height: 338;"> <img src="<%=body_img%>" border="0">                        
                  <%
set rs=server.CreateObject("adodb.recordset")

sql = "Select * From suit where username='"&friend&"' and selected=1"
rs.open sql,conn,1,1

if not rs.eof then
%>
<% for i=1 to rs.recordcount

obj_num=rs.recordcount
div_num=obj_num+2          '确定移动量,就是说右键菜单 “移动最前” 的移动量,2表示用户和室友
url=rs("url")
id=rs("id")
%>
<DIV  onmouseup=disableMove(); onmousedown=enableMove(this);  id=DIV_GIFT_<%=rs("id")%> style="Z-INDEX: 0; LEFT: 0px;  POSITION: absolute; TOP:0px;"><IMG src="<%=url%>"> </DIV>
    <%
rs.movenext
next
end if
rs.close
'set rs=nothing
'conn.close
%>
</div> </DIV>
<% end if%>
<!--  室友形象照片的显示及位置的控制 结束 -->

板凳

<!--  家居用品照片的显示及位置的控制  -->
<%

sql="select * from room_obj where username='"&Session("Current_user")&"' and selected=1 and room_kind=1 order by id desc"
rs.open sql,conn,1,1
if not rs.eof then
%>
<% for i=1 to rs.recordcount

obj_num=rs.recordcount
div_num=obj_num+2          '确定移动量,就是说右键菜单 “移动最前” 的移动量,2表示用户和室友
url=rs("url")
id=rs("id")

str="<script type='text/javascript' language='JavaScript1.2'>"& vbcrlf
str=str& " function showmenu"&id&"() "& vbcrlf
str=str&" { "& vbcrlf

str=str&" var rightedge=event.clientX "& vbcrlf
str=str& "var bottomedge=event.clientY "& vbcrlf
str=str& "if (rightedge>480) "& vbcrlf
str=str& " ie5menu"&id&".style.left=480 "& vbcrlf 
str=str& " else "& vbcrlf
str=str& "ie5menu"&id&".style.left=rightedge+20 "& vbcrlf
str=str& "if (bottomedge>480) "& vbcrlf
str=str& "ie5menu"&id&".style.top=480 "& vbcrlf
str=str& " else "& vbcrlf
str=str& " ie5menu"&id&".style.top=bottomedge "& vbcrlf
str=str& "ie5menu"&id&".style.visibility='visible' "& vbcrlf
str=str& " return false "& vbcrlf

str=str&" } "&vbcrlf
str=str&"</script>"&vbcrlf

response.write str

%>
<input type="hidden" name="posleft_<%=rs("id")%>" id="posleft_<%=rs("id")%>">
<input type="hidden" name="postop_<%=rs("id")%>" id="postop_<%=rs("id")%>">
<DIV  onmouseup=disableMove(); onmousedown=enableMove(this); <%response.write "oncontextmenu='return showmenu"&id&"()' ;"%> id=DIV_GIFT_<%=rs("id")%> style="Z-INDEX: <%=rs("pos_z")%>; LEFT: <%=rs("pos_left")%>px;  POSITION: absolute; TOP: <%=rs("pos_top")%>px;<%if rs("pos_FlipH")=1 then%>filter:FlipH <%else%> <%end if%>;<%if rs("pos_gray")=1 then%>filter:gray; <%else%> <%end if%> "><IMG src="<%=url%>"> </DIV>
<div id="<%="ie5menu"&id %>" style="position:absolute; left:619px; top:137px; width:107px; height:132px; z-index:100; visibility: hidden;">
  <div align="center">
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2CAB6">
      <tr >
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'"  style="cursor:default "><a href="div_up.asp?type=3&id=<%=id%>&num=<%=div_num%>">上移一层</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_down.asp?type=3&id=<%=id%>">下移一层</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_top.asp?type=3&id=<%=id%>&num=<%=div_num%>">放到最前</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_bottom.asp?type=3&id=<%=id%>">放到最后</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_float.asp?type=3&id=<%=id%>">水平翻</a></div></td>
     </tr>
         <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="Room_set_remove_2.asp?typeid=3&id=<%=id%>">移出套房</a></div></td>
      </tr>

    </table>
  </div>
</div>

    <%
rs.movenext
next
end if
rs.close
set rs=nothing
conn.close
%>
  <div align="center">
  <!--  家居用品照片的显示及位置的控制  结束 -->
  
    <input  onclick="SavePos()" type="submit" name="Submit1" value="保存设置" >
    <input type="button" name="Submit" value="刷新套房" onClick="javascript:location.href='room_2.asp'">
    </div>
        </form>
</span>
<div id="ie5menu" style="position:absolute; left:619px; top:137px; width:107px; height:132px; z-index:2; visibility: hidden;">
  <div align="center">
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2CAB6">
      <tr >
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'"  style="cursor:default "><a href="div_up.asp?type=1&username=<%=session("Current_user")%>&num=<%=div_num%>">上移一层</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_down.asp?type=1&username=<%=session("Current_user")%>">下移一层</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_top.asp?type=1&username=<%=session("Current_user")%>&num=<%=div_num%>">放到最前</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_bottom.asp?type=1&username=<%=session("Current_user")%>">放到最后</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'"  style="cursor:default "><a href="div_float.asp?type=1&username=<%=session("Current_user")%>">水平翻转</a></div></td>
      </tr>

    </table>
  </div>
</div>
<div id="ie5menu2" style="position:absolute; left:619px; top:137px; width:107px; height:132px; z-index:2; visibility: hidden;">
  <div align="center">
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2CAB6">
      <tr >
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'"  style="cursor:default "><a href="div_up.asp?type=2&username=<%=friend%>&num=<%=div_num%>">上移一层</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_down.asp?type=2&username=<%=friend%>">下移一层</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_top.asp?type=2&username=<%=friend%>&num=<%=div_num%>">放到最前</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_bottom.asp?type=2&username=<%=friend%>">放到最后</a></div></td>
      </tr>
      <tr>
        <td><div align="center" onMouseOut="this.style.backgroundColor='#F2CAB6'" onMouseOver="this.style.backgroundColor='#EFF3FF'" style="cursor:default "><a href="div_float.asp?type=2&username=<%=friend%>">水平翻转</a></div></td>
      </tr>

    </table>
  </div>
</div>

<script language="JavaScript">
<!--
if (document.all&&window.print){
    ie5menu.className="cMenu"
    //document.oncontextmenu=showmenuie5
    document.body.onclick=hidemenuie5
    
}
//-->
</script>
<bgsound src="<%=bg_sound%>" loop="-1">

3 楼

o,my dear!

4 楼

http://pcfun.cn/walq的作者有可能帮到你

我来回复

您尚未登录,请登录后再回复。点此登录或注册